Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a constant for the colors in the Julia logo #418

Merged
merged 5 commits into from
Apr 26, 2020
Merged

Add a constant for the colors in the Julia logo #418

merged 5 commits into from
Apr 26, 2020

Conversation

tpapp
Copy link
Contributor

@tpapp tpapp commented Apr 22, 2020

The colors from the Julia logo are frequently used for various visualizations and logo designs, private or public, so I thought they would be useful in this package.

At the same time, I did not put them in the named colors namespace since they are unique to Julia, not a shared color name space like X11 or SVG (cf this comment by @kimikage). For the same reason, they are not exported, just mentioned in the docs.

Happy to make any changes.

(RGB color codes just extracted from the svg in the JuliaLang/julia repository with Inkscape).

@kimikage
Copy link
Collaborator

Thank you for submitting this PR and your consideration for the cleanness of namespace.

(RGB color codes just extracted from the svg in the JuliaLang/julia repository with Inkscape).

The official definitions of the colors are found in https://github.com/JuliaLang/julia-logo-graphics. The difference is weird. 🤔
In any case, we should use the official definitions.

My concern is whether JULIA_LOGO_COLORS can be easily recalled. It's not clear which of the Colors.jl documentation or the site above is easier to access. 😅

If we don't add the colors to the named colors, what about adding the juliacolor_str macro (e.g. juliacolor"red")? The string literal macro seems unlikely to cause name conflicts, so IMO, exporting the macro may be OK.

cc: @cormullion

@cormullion
Copy link
Member

It's a great idea! I think JULIA_LOGO_COLORS.red etc seems a pretty good way to get the colors.

The color specifications currently originate from Luxor.jl:

julia> Luxor.julia_red, Luxor.julia_green, Luxor.julia_blue, Luxor.julia_purple
((0.796, 0.235, 0.2), (0.22, 0.596, 0.149), (0.251, 0.388, 0.847), (0.584, 0.345, 0.698))

julia> JULIA_LOGO_COLORS
(red = RGB{N0f8}(0.792,0.235,0.196), green = RGB{N0f8}(0.224,0.592,0.275), blue = RGB{N0f8}(0.302,0.392,0.682), purple = RGB{N0f8}(0.573,0.349,0.639))

so they're pretty close (I probably couldn't spot the difference, but I suspect you can, @kimikage :)).

(The "julia-logo-graphics" repo is kind of official, now that it's been transferred from my github to JuliaLang. But there was never really any official specification of the logo or colors before then - the logo image just travelled around in various formats, and I eventually decided to pin it down and draw it procedurally.)

@tpapp
Copy link
Contributor Author

tpapp commented Apr 22, 2020

@kimikage: I checked and the colors match the ones in julia.svg in the latest master. I checked the repo you linked and it is my understanding that it just draws colors from Luxor.jl --- while I like that package very much, I am not sure in what sense it is more official than the Julia repository. Naturally, if the colors are updated in the latter, that should be reflected here.

The purpose of this PR is to make these colors easier to access when needed for Julia programs. I am not sure in what sense you consider the repo above an alternative; the colors are not accessible in code directly, they would need to be typed in from an image in that repository, which is tedious and error-prone.

In order to avoid getting into the "which colors are official" debate, perhaps I should amend the docstring to say that it should just reflect whatever is in the Julia repository, and kept updated accordingly, without considering these changes breaking.

@tpapp
Copy link
Contributor Author

tpapp commented Apr 22, 2020

Regarding the macro: I just prefer a constant. We are talking about a very small set of values after all, for which something like a NamedTuple is ideal, providing completion etc out of the box.

@cormullion
Copy link
Member

cormullion commented Apr 22, 2020

The julia.svg in the main JuliaLang repository was created by Luxor-... 🤷. I expect the differences in values are due to different ways of converting the original 0 -> 1.0 values to those hexadecimal codes.

@kimikage
Copy link
Collaborator

kimikage commented Apr 23, 2020

As I want to use these colors ​​for testing, I don't care which one is "official", but the existence of multiple possible answers is a concern.:confused:

We should consider the possibility of the unification before merging this PR. And, first of all, the "copyright owner" should have the first say.

I also think we should clarify the reason for the variation. To be precise, the cause itself is not so important, but we should make sure that the same problem does not recur. Some differences can be explained as rounding errors, but when it comes to "blue", they are clearly different colors.

Regarding the macro: I just prefer a constant.

Adding macros does not mean removing constants. We need a dictionary-like object to convert from strings to colors. However, the macro is just a possible idea.

@cormullion
Copy link
Member

"what happened in round2" - I can't remember now, but I must have used the wrong file at some point.

@tpapp
Copy link
Contributor Author

tpapp commented Apr 23, 2020

Frankly, I expected this PR to be rather trivial (conditional on the functionality being considered to have a place in this package), and I am somewhat surprised about the whole "which colors are official" discussion, with the claim that some other colors are, because they are used in a package that was ostensibly used to create the logo, which nevertheless ended up having different colors.

The point of the whole PR is to just make using some colors that some people use anyway easier. I don't wish to invest too much in this, and I don't see the point of waiting for a resolution between the semi-official logo repo and the svg file. If/when that happens, colors here can change too.

In any case, feel free to ignore/close/modify this PR.

@kimikage
Copy link
Collaborator

kimikage commented Apr 23, 2020

At least the discussion of "which color is official" ended. The current discussion is about "official" colors, not unofficial or semi-official. So, it's not appropriate to have that discussion in this PR or in Colors.jl.

Edit:
It is a situation I had not imagined as of yesterday, but as a result it seems better to use the definitions in julia-logo-graphics.

@kimikage
Copy link
Collaborator

As the log of Travis CI shows, the document cannot be built due to the specification change of nightly build now. Although problem can be solved by ignoring the failure, I am currently exploring best practices. In the meantime, I leave this PR open.

BTW, I want to add the swatches of the colors to the document.
By suppressing the display in "text/plain", showing swatches in SVG is enabled.

showable(::MIME"text/plain", ::AbstractVector{C}) where {C<:Colorant} = false # hide

@tpapp
Copy link
Contributor Author

tpapp commented Apr 24, 2020

@kimikage, @cormullion: thanks for clearing this up. I have updated the colors accordingly.

Copy link
Collaborator

@kimikage kimikage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The nightly build now passes the tests. The only fix I request is docs->@docs. The color swatches are optional but I love something colorful.

logocolors

docs/src/namedcolors.md Outdated Show resolved Hide resolved
docs/src/namedcolors.md Outdated Show resolved Hide resolved
tpapp and others added 2 commits April 26, 2020 12:19
@codecov
Copy link

codecov bot commented Apr 26, 2020

Codecov Report

Merging #418 into master will increase coverage by 0.22%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #418      +/-   ##
==========================================
+ Coverage   81.06%   81.29%   +0.22%     
==========================================
  Files          10       10              
  Lines         882      882              
==========================================
+ Hits          715      717       +2     
+ Misses        167      165       -2     
Impacted Files Coverage Δ
src/parse.jl 95.71% <ø> (+2.85%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 646f45c...cd412dc. Read the comment docs.

@kimikage kimikage merged commit 0b7f76c into JuliaGraphics:master Apr 26, 2020
@kimikage
Copy link
Collaborator

Thanks!

@kimikage kimikage mentioned this pull request May 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants