# Plots: JuliaGraphics / Colors.jl removing the guess of colours

**URL:** https://discourse.julialang.org/t/plots-juliagraphics-colors-jl-removing-the-guess-of-colours/50010
**Category:** General Usage
**Tags:** plots, colour
**Created:** [November 11, 2020, 11:30pm UTC](https://discourse.julialang.org/t/plots-juliagraphics-colors-jl-removing-the-guess-of-colours/50010 "2020-11-11T23:30:38Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![JosephPollacco](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/josephpollacco/32/51404_2.png) [@JosephPollacco](https://discourse.julialang.org/u/JosephPollacco)
#### Post date: [November 11, 2020, 11:30pm UTC](https://discourse.julialang.org/t/plots-juliagraphics-colors-jl-removing-the-guess-of-colours/50010/1 "2020-11-11T23:30:38Z")

</div>

We are ever so grateful of having such a great variety of colour options in Plots which is great for publications. But the question is how can we get a preview of the colour before trying them out?

[Colours](https://github.com/JuliaGraphics/Colors.jl/blob/master/src/names_data.jl)

```julia

# This is the union of every color defined in X11 and in SVG, prefering the SVG
# definition when they clash.
const color_names = Dict(
    "aliceblue" => (240, 248, 255),
    "antiquewhite" => (250, 235, 215),
    "antiquewhite1" => (255, 239, 219),
    "antiquewhite2" => (238, 223, 204),
    "antiquewhite3" => (205, 192, 176),
    "antiquewhite4" => (139, 131, 120),
    "aqua" => ( 0, 255, 255),
    "aquamarine" => (127, 255, 212),
    "aquamarine1" => (127, 255, 212),
    "aquamarine2" => (118, 238, 198),
    "aquamarine3" => (102, 205, 170),
    "aquamarine4" => ( 69, 139, 116),
etc...

```

It will be amazing if we can get something like:

 ![Plot3](https://global.discourse-cdn.com/julialang/original/3X/b/6/b681a3c7ea850208f78eef5f17141a887f6599f1.png)

Many thanks for any help you may provide,  
Joseph

---

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [November 12, 2020, 10:29am UTC](https://discourse.julialang.org/t/plots-juliagraphics-colors-jl-removing-the-guess-of-colours/50010/2 "2020-11-12T10:29:48Z")

</div>

The `xcolor` docs has a section that lists them all (“colors by name”):

> **[xcolor.pdf](https://mirror.mwt.me/ctan/macros/latex/contrib/xcolor/xcolor.pdf)**
>
> 844.36 KB

Your TeX installation may have a local copy, too, use `texdoc xcolor` or similar to access it.

---

<div class="post-metadata">

### Author: ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)
#### Post date: [November 12, 2020, 11:28am UTC](https://discourse.julialang.org/t/plots-juliagraphics-colors-jl-removing-the-guess-of-colours/50010/3 "2020-11-12T11:28:17Z")

</div>

You could try diving into the Colors.jl package and display a chart. In a terminal:

```julia
open .julia/packages/Colors/kc2v8/images/color_names_sorted.svg

```

On my Mac this opens in the Safari web browser. The `kc2v8` is the package ID, it might be different for you…

 ![Screenshot 2020-11-12 at 11.27.24](https://global.discourse-cdn.com/julialang/original/3X/e/4/e4774437caf2917db7b4c806c043cc253ccf54f9.png)

---

<div class="post-metadata">

### Author: ![tim.holy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tim.holy/32/52_2.png) [@tim.holy](https://discourse.julialang.org/u/tim.holy)
#### Post date: [November 12, 2020, 2:08pm UTC](https://discourse.julialang.org/t/plots-juliagraphics-colors-jl-removing-the-guess-of-colours/50010/4 "2020-11-12T14:08:00Z")

</div>

Finally in a VSCode or IJulia terminal (probably Pluto too?) if you just let a color value display it will show as the color.

---

<div class="post-metadata">

### Author: ![sijo](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@sijo](https://discourse.julialang.org/u/sijo)
#### Post date: [November 12, 2020, 3:14pm UTC](https://discourse.julialang.org/t/plots-juliagraphics-colors-jl-removing-the-guess-of-colours/50010/5 "2020-11-12T15:14:22Z")

</div>

To expand on @tim.holy’s answer, running the following in IJulia will show the name and color (as a 25x25 mm square) for every color defined in that file:

```julia
using Colors
for c in Colors.color_names
    display(c.first)
    display(RGB((c.second./255)...))
end

```

![image](https://global.discourse-cdn.com/julialang/original/3X/f/f/ff31173af292615d1194dd5bd09ccdd61ed5edb4.png)

Or to get a more compact output:

```julia
using Colors
for (name, code) in Colors.color_names
    rgb = RGB((code./255)...)
    rgb_html = "<span style='background-color: #$(hex(rgb)); padding: 10px;'/>"
    display("text/html", "$rgb_html $name")
end

```

![image](https://global.discourse-cdn.com/julialang/original/3X/d/f/df13b1be4fe11ddab3a9c854e2253e818343f307.png)

---

<div class="post-metadata">

### Author: ![JosephPollacco](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/josephpollacco/32/51404_2.png) [@JosephPollacco](https://discourse.julialang.org/u/JosephPollacco)
#### Post date: [November 12, 2020, 10:09pm UTC](https://discourse.julialang.org/t/plots-juliagraphics-colors-jl-removing-the-guess-of-colours/50010/6 "2020-11-12T22:09:04Z")

</div>

It is so amazing to have such a vibrant community 😌. I am wandering if we can update the website to include a link to a pdf file with the name of the colour and the colour sample as you kindly showed above:  
https://github.com/JuliaGraphics/Colors.jl/blob/master/src/names\_data.jl

---

<div class="post-metadata">

### Author: ![sijo](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@sijo](https://discourse.julialang.org/u/sijo)
#### Post date: [November 17, 2020, 8:29am UTC](https://discourse.julialang.org/t/plots-juliagraphics-colors-jl-removing-the-guess-of-colours/50010/7 "2020-11-17T08:29:13Z")

</div>

The Colors.jl documentation has [Named Colors · Colors](http://juliagraphics.github.io/Colors.jl/stable/namedcolors/)

Is this what you had in mind?

---

<div class="post-metadata">

### Author: ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)
#### Post date: [November 17, 2020, 8:56am UTC](https://discourse.julialang.org/t/plots-juliagraphics-colors-jl-removing-the-guess-of-colours/50010/8 "2020-11-17T08:56:55Z")

</div>

Perhaps OP was working offline… It’s not easy to browse the documentation for Julia packages if you’re off-line - the downloaded package contains the documentation sources, but it doesn’t have the built HTML files.

---

<div class="post-metadata">

### Author: ![JosephPollacco](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/josephpollacco/32/51404_2.png) [@JosephPollacco](https://discourse.julialang.org/u/JosephPollacco)
#### Post date: [November 25, 2020, 9:45am UTC](https://discourse.julialang.org/t/plots-juliagraphics-colors-jl-removing-the-guess-of-colours/50010/9 "2020-11-25T09:45:21Z")

</div>

A great thanks for providing me the solution to our question.

Will you kindly update the website to link:  
https://github.com/JuliaGraphics/Colors.jl/blob/master/src/names\_data.jl

With  
http://juliagraphics.github.io/Colors.jl/stable/namedcolors/

Thanks,  
Joseph

---

<div class="post-metadata">

### Author: ![sijo](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@sijo](https://discourse.julialang.org/u/sijo)
#### Post date: [November 25, 2020, 11:19am UTC](https://discourse.julialang.org/t/plots-juliagraphics-colors-jl-removing-the-guess-of-colours/50010/10 "2020-11-25T11:19:04Z")

</div>

This is twice the same URL… Do you want to modify [Named Colors · Colors](http://juliagraphics.github.io/Colors.jl/stable/namedcolors/) to link to the source code? You can propose the change yourself: click on “Edit on GitHub” in the top right corner of that page, then click on the pencil icon to propose a change.
