# Add named colors and use them in PlotlyJS

**URL:** <https://discourse.julialang.org/t/add-named-colors-and-use-them-in-plotlyjs/104522>\
**Category:** New to Julia\
**Tags:** question, plotting\
**Created:** [October 3, 2023, 3:47am UTC](https://discourse.julialang.org/t/add-named-colors-and-use-them-in-plotlyjs/104522 "2023-10-03T03:47:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mjmat](https://avatars.discourse-cdn.com/v4/letter/m/85f322/32.png) [@mjmat](https://discourse.julialang.org/u/mjmat)\
**Post date:** [October 3, 2023, 3:47am UTC](https://discourse.julialang.org/t/add-named-colors-and-use-them-in-plotlyjs/104522/1 "2023-10-03T03:47:59Z")

</div>

Hello,  
First, I am not sure how to properly add named colors to Colors.jl - I think that might be the main problem.  
I managed to (apparently) add a named color by running:

```julia
using Colors
Colors.color_names = merge!(Colors.color_names, Dict("myred" => (202,29,39)))

```

In VSCode for example I can see a patch with the proper color by typing:

```julia
colorant"myred"

```

But I can’t seem to be able to use that color in PlotlyJS as easily as predefined colors. This works:

```julia
using PlotlyJS
plot(scatter(; x=[1,2,3], y=[5,1,5], line_color=colorant"myred"))

```

But if I try the shorter forms, e.g.

```julia
plot(scatter(; x=[1,2,3], y=[5,1,5], line_color="myred"))
plot(scatter(; x=[1,2,3], y=[5,1,5], line_color=:myred))

```

I get a blue line (the default, as if line\_color was not “seen”). replacing `myred` with `red` for example gets me a red line, so it seems that my added color (myred) is not “as visible” to PlotlyJS as the predefined ones.  
Is there any way to “really” add named colors that would be treated as the default ones?  
Thanks!
