# Changing line color Theme in CairoMakie and GLMakie

**URL:** <https://discourse.julialang.org/t/changing-line-color-theme-in-cairomakie-and-glmakie/88990>\
**Category:** Visualization\
**Tags:** plotting, makie\
**Created:** [October 20, 2022, 3:05am UTC](https://discourse.julialang.org/t/changing-line-color-theme-in-cairomakie-and-glmakie/88990 "2022-10-20T03:05:47Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![garrek](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/garrek/32/27937_2.png) [@garrek](https://discourse.julialang.org/u/garrek)\
**Post date:** [October 20, 2022, 3:05am UTC](https://discourse.julialang.org/t/changing-line-color-theme-in-cairomakie-and-glmakie/88990/1 "2022-10-20T03:05:47Z")

</div>

I’m trying to define a custom plotting theme in Makie.jl. I want to remove the default color cycle for Lines and have black be the default color. I’m not sure if my syntax is correct, but it works in CairoMakie. But, when I activate the GLMakie backend and use `display()`, I get the following error:

`ERROR: MethodError: no method matching gl_convert(::Symbol)`

I’ve tried a few combinations for where to put `cycle = nothing` and `linecolor = :black`, but I still get stuck. I’m referencing the [Cycles](https://docs.makie.org/stable/documentation/theming/index.html#cycles) section of the Theming documentation.

(The reason I want to do this theme is that I want just the shape of a function to import into Affinity Designer and use that to fill in colors, etc. as part of a project.)

Code:

```julia
function theme_af()
    Theme(
        backgroundcolor = :transparent,
        Lines = (cycle = nothing, linecolor = :black),

        Axis = (
            backgroundcolor = :transparent,
            xgridvisible = false,
            ygridvisible = false,
            xminorgridvisible = false,
            yminorgridvisible = false,
            leftspinevisible = false,
            rightspinevisible = false,
            bottomspinevisible = false,
            topspinevisible = false,
            xminorticksvisible = false,
            yminorticksvisible = false,
            xticksvisible = false,
            yticksvisible = false,
            xticklabelsvisible = false,
            yticklabelsvisible = false,
        ),
)
end

set_theme!(theme_af())

f, ax, l = lines(1..10, sin)
display(f)

```

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [October 20, 2022, 4:55am UTC](https://discourse.julialang.org/t/changing-line-color-theme-in-cairomakie-and-glmakie/88990/2 "2022-10-20T04:55:17Z")

</div>

When you group it under Lines it’s just color not linecolor. Linecolor is a theme “global” so to speak which Line inherits its color setting from by default.

---

<div class="post-metadata">

**Author:** ![garrek](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/garrek/32/27937_2.png) [@garrek](https://discourse.julialang.org/u/garrek)\
**Post date:** [October 20, 2022, 6:04am UTC](https://discourse.julialang.org/t/changing-line-color-theme-in-cairomakie-and-glmakie/88990/3 "2022-10-20T06:04:36Z")

</div>

Thank you. Relatedly, I notice another difference that I can’t figure out. In the same example, with the first `backgroundcolor` set to `:transparent`, the plot is not visible when using GLMakie (Changing it to `:white` or some other color makes it visible again). But in CairoMakie, I see the plot and the grayed-out transparent background as expected. Am I doing something wrong here, too? I’m assuming the figure `backgroundcolor` is different from the Axis block `backgroundcolor`.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [October 20, 2022, 12:38pm UTC](https://discourse.julialang.org/t/changing-line-color-theme-in-cairomakie-and-glmakie/88990/4 "2022-10-20T12:38:13Z")

</div>

GLMakie cannot do a transparent figure background, the buffer doesn’t hold RGBAs (the A is used for the stencil buffer I think?)

---

<div class="post-metadata">

**Author:** ![garrek](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/garrek/32/27937_2.png) [@garrek](https://discourse.julialang.org/u/garrek)\
**Post date:** [October 21, 2022, 3:56am UTC](https://discourse.julialang.org/t/changing-line-color-theme-in-cairomakie-and-glmakie/88990/5 "2022-10-21T03:56:05Z")

</div>

That makes sense. Thank you!

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [October 21, 2022, 6:49am UTC](https://discourse.julialang.org/t/changing-line-color-theme-in-cairomakie-and-glmakie/88990/6 "2022-10-21T06:49:43Z")

</div>

It’s too bad but it seemed it would be nontrivial to change without major pipeline refactoring.

---

<div class="post-metadata">

**Author:** ![garrek](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/garrek/32/27937_2.png) [@garrek](https://discourse.julialang.org/u/garrek)\
**Post date:** [October 21, 2022, 8:59am UTC](https://discourse.julialang.org/t/changing-line-color-theme-in-cairomakie-and-glmakie/88990/7 "2022-10-21T08:59:25Z")

</div>

Seems like you spent some time going down that path.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [October 21, 2022, 9:40am UTC](https://discourse.julialang.org/t/changing-line-color-theme-in-cairomakie-and-glmakie/88990/8 "2022-10-21T09:40:22Z")

</div>

Not me personally, but @ffreyer and @sdanisch
