# Default linecolor name in Plots.jl?

**URL:** <https://discourse.julialang.org/t/default-linecolor-name-in-plots-jl/125634>\
**Category:** Visualization\
**Tags:** colors, plots\
**Created:** [February 6, 2025, 9:04pm UTC](https://discourse.julialang.org/t/default-linecolor-name-in-plots-jl/125634 "2025-02-06T21:04:07Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![BVPs](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bvps/32/2190_2.png) [@BVPs](https://discourse.julialang.org/u/BVPs)\
**Post date:** [February 6, 2025, 9:04pm UTC](https://discourse.julialang.org/t/default-linecolor-name-in-plots-jl/125634/1 "2025-02-06T21:04:07Z")

</div>

Hello. I thought that the default linecolor for plotting lines in Plots.jl was `:steelblue`. But upon close examination, it seems to be different. It’s actually closer to `:dodgerblue`. Is there any julia function that returns the linecolor name just used?  
Thanks a lot!

---

<div class="post-metadata">

**Author:** ![cocoa1231](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cocoa1231/32/22215_2.png) [@cocoa1231](https://discourse.julialang.org/u/cocoa1231)\
**Post date:** [February 6, 2025, 9:14pm UTC](https://discourse.julialang.org/t/default-linecolor-name-in-plots-jl/125634/2 "2025-02-06T21:14:41Z")

</div>

I think you can get the palette using `PlotThemes.theme_palette(:default)`. It gives me this

```julia
ColorPalette(ColorSchemes.ColorScheme{Vector{RGB{Float64}}, String, String}(RGB{Float64}[RGB(0.0, 0.6056031704619725, 0.9786801190138923), RGB(0.8888735440600661, 0.435649148506399, 0.2781230452972766), RGB(0.24222393333911896, 0.6432750821113586, 0.304448664188385), RGB(0.7644400000572205, 0.4441118538379669, 0.8242975473403931), RGB(0.6755439043045044, 0.5556622743606567, 0.09423444420099258), RGB(0.0, 0.6657590270042419, 0.6809969544410706), RGB(0.9307674765586853, 0.3674771189689636, 0.5757699012756348), RGB(0.776981770992279, 0.5097429752349854, 0.14642538130283356), RGB(5.29969987894674e-8, 0.6642677187919617, 0.5529508590698242), RGB(0.558464765548706, 0.59348464012146, 0.11748137325048447), RGB(0.0, 0.6608786582946777, 0.7981787919998169), RGB(0.609670877456665, 0.49918484687805176, 0.9117812514305115), RGB(0.38000133633613586, 0.5510532855987549, 0.9665056467056274), RGB(0.9421815872192383, 0.3751642107963562, 0.4518167972564697), RGB(0.8684020638465881, 0.39598923921585083, 0.7135148048400879), RGB(0.4231467843055725, 0.6224954128265381, 0.19877080619335175)], "", ""))

```

And I’m pretty sure the default blue is `RGB(0.0, 0.6056031704619725, 0.9786801190138923)`. Not sure if it has a name. I’ll dig around and update

* * *

Update: I’ve found the default colors here: [PlotUtils.jl/src/color\_utils.jl at e1beb9e3346fb60ed8753d34839b9c8f72adc5a7 · JuliaPlots/PlotUtils.jl · GitHub](https://github.com/JuliaPlots/PlotUtils.jl/blob/e1beb9e3346fb60ed8753d34839b9c8f72adc5a7/src/color_utils.jl#L19)

```julia
function generate_colorscheme(
    bgcolor = plot_color(:white);
    color_bases = plot_color([colorant"steelblue", colorant"orangered"]),
    lightness = lightness_from_background(bgcolor),
    chroma = _lch_c_const[],
    n = 17,
)
    seed_colors = vcat(bgcolor, map(c -> adjust_lch(c, lightness, chroma), color_bases))
    seed_colors = convert(Vector{RGB{Float64}}, seed_colors)
    colors = distinguishable_colors(
        n,
        seed_colors,
        lchoices = Float64[lightness],
        cchoices = Float64[chroma],
        hchoices = range(0; stop = 340, length = 20),
    )[2:end]
    ColorScheme(colors)
end

```

So it is `colorant"steelblue"`, and seems like it’s ran through `adjust_lch` which I think is converting the color to `LCHab` color space, taking the hue, constructing an `LCHab` instance with given lightness and colorfulness, and then converting back to RGBA. Why? idk I have no idea how colors work, I just did “go to definition” in my editor. Maybe the difference you’re seeing is because of this, but the colorant is steel blue.

```julia
adjust_lch(color, l, c) = convert(RGBA{Float64}, LCHab(l, c, convert(LCHab, color).h))

```

* * *

Update 2: Yes there is a difference between the default blue and steel blue. It’s there because of that function above. I ran it with the default values of `l` and `c` and got this.

```julia-repl
julia> cp = theme_palette(:default);

julia> convert(RGB, PlotUtils.adjust_lch(colorant"steelblue", PlotUtils.lightness_from_background(plot_color(:white)), PlotUtils._lch_c_const[]))
RGB{Float64}(0.0, 0.6056031549975471, 0.9786801270072305)

julia> cp.colors.colors[1]
RGB{Float64}(0.0, 0.6056031704619725, 0.9786801190138923)

julia> colorant"steelblue"
RGB{N0f8}(0.275, 0.51, 0.706)

```

---

<div class="post-metadata">

**Author:** ![BVPs](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bvps/32/2190_2.png) [@BVPs](https://discourse.julialang.org/u/BVPs)\
**Post date:** [February 6, 2025, 9:51pm UTC](https://discourse.julialang.org/t/default-linecolor-name-in-plots-jl/125634/3 "2025-02-06T21:51:12Z")

</div>

Thank you very much for your investigation!!  
But then, how can we specify the exact color of `colorant"steelblue"` in the `plot` function explicitly via `color=` argument? If we specify it by `color=:steelblue` or `color=colorant"steelblue"`, it renders a bit different color than the original default linecolor. Sometimes, we want to specify that color explicitly.

---

<div class="post-metadata">

**Author:** ![cocoa1231](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cocoa1231/32/22215_2.png) [@cocoa1231](https://discourse.julialang.org/u/cocoa1231)\
**Post date:** [February 6, 2025, 9:54pm UTC](https://discourse.julialang.org/t/default-linecolor-name-in-plots-jl/125634/4 "2025-02-06T21:54:46Z")

</div>

You can get the default blue by getting the first color in the color palette

```julia
using Plots

default_blue = theme_palette(:default)[1]

```

---

<div class="post-metadata">

**Author:** ![BVPs](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bvps/32/2190_2.png) [@BVPs](https://discourse.julialang.org/u/BVPs)\
**Post date:** [February 6, 2025, 9:57pm UTC](https://discourse.julialang.org/t/default-linecolor-name-in-plots-jl/125634/5 "2025-02-06T21:57:42Z")

</div>

> [@cocoa1231](#):
>
> `default_blue = theme_palette(:default)[1]`

Thanks a lot, @cocoa1231 !! It worked! However, it would be really great if there is a standard name for it, like `:steelblue` or `:dodgerblue`, etc. I hope someone who knows the colorscheme can help us.

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [February 7, 2025, 12:06am UTC](https://discourse.julialang.org/t/default-linecolor-name-in-plots-jl/125634/6 "2025-02-07T00:06:36Z")

</div>

FWIW, I get the `deepskyblue2` as the “closest” color by running:

```julia
using Plots, Colors, LinearAlgebra

default_blue = theme_palette(:default)[1]
c0 = [default_blue.r, default_blue.g, default_blue.b]

name = ""
d = 1.0
for c in Colors.color_names
    dc = norm([(c.second ./255)...] - c0)
    if dc < d
        name = c.first
        d = dc
    end
end
println(name) # deepskyblue2

```

---

<div class="post-metadata">

**Author:** ![BVPs](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bvps/32/2190_2.png) [@BVPs](https://discourse.julialang.org/u/BVPs)\
**Post date:** [February 7, 2025, 1:01am UTC](https://discourse.julialang.org/t/default-linecolor-name-in-plots-jl/125634/7 "2025-02-07T01:01:30Z")

</div>

Thanks a lot, @rafael.guerra! However, by running the following MWE, `:dodgerblue` seems to be closer to the default blue:

```julia
using Plots
default_blue = theme_palette(:default)[1]
x=collect(1:10)
plot(x, x, linewidth=10, label="default blue")
plot!(x, x.+1, linewidth=10, color=default_blue, label="from palette")
plot!(x, x.+2, linewidth=10, color=:deepskyblue2, label=":deepskyblue2")
plot!(x, x.+3, linewidth=10, color=:dodgerblue, label=":dodgerblue")
plot!(x, x.+4, linewidth=10, color=:steelblue, label=":steelblue")

```

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [February 7, 2025, 1:02am UTC](https://discourse.julialang.org/t/default-linecolor-name-in-plots-jl/125634/8 "2025-02-07T01:02:39Z")

</div>

Ok, the metric used was not good then.

By using a proper metric available in [colordiff](https://juliagraphics.github.io/Colors.jl/stable/colordifferences/), we now get `:dodgerblue1` as the closest color :

```julia
using Plots, Colors

c0 = first(theme_palette(:default))
name = ""
d = 100
for c in Colors.color_names
    dc = colordiff(RGB((c.second ./255)...), c0)
    if dc < d
        name = c.first
        d = dc
    end
end
println(name) # dodgerblue1

```

---

<div class="post-metadata">

**Author:** ![BVPs](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bvps/32/2190_2.png) [@BVPs](https://discourse.julialang.org/u/BVPs)\
**Post date:** [February 7, 2025, 5:10pm UTC](https://discourse.julialang.org/t/default-linecolor-name-in-plots-jl/125634/9 "2025-02-07T17:10:39Z")

</div>

Thanks a lot, @rafael.guerra and @cocoa1231 !!  
Now, we have two choices:  
(1) `default_blue = theme_palette(:default)[1]; plot(..., color=default_blue)` for exactly the same color as the default; or  
(2) `plot(..., color=:dodgerblue)` for approximately the same color as the default one.  
According to [Colors.jl/src/names\_data.jl at master · JuliaGraphics/Colors.jl](https://github.com/JuliaGraphics/Colors.jl/blob/master/src/names_data.jl), `dodgerblue` and `dodgerblue1` are the same.
