# How to change default color theme in Makie?

**URL:** <https://discourse.julialang.org/t/how-to-change-default-color-theme-in-makie/95251>\
**Category:** Visualization\
**Tags:** makie\
**Created:** [February 27, 2023, 3:17am UTC](https://discourse.julialang.org/t/how-to-change-default-color-theme-in-makie/95251 "2023-02-27T03:17:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rmsmsgood](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rmsmsgood/32/20544_2.png) [@rmsmsgood](https://discourse.julialang.org/u/rmsmsgood)\
**Post date:** [February 27, 2023, 3:17am UTC](https://discourse.julialang.org/t/how-to-change-default-color-theme-in-makie/95251/1 "2023-02-27T03:17:39Z")

</div>

☹ tried belows, but no one works.

```julia-auto
using CairoMakie, LaTeXStrings

set_theme!(color = :blue)
set_theme!(colors = :darktest)
set_theme!(colormap = :Hiroshige) # https://docs.makie.org/stable/api/index.html#Makie
set_theme!(colormap = :darktest)
set_theme!(colormaps = :darktest)
set_theme!(palette = :darktest)
set_theme!(palette = (patchcolor = [:red, :green, :blue, :yellow, :orange, :pink],)) # https://docs.makie.org/stable/documentation/theming/index.html#palettes
set_theme!(palette = (; patchcolor = cgrad(:Egypt, alpha=0.65))) # https://docs.makie.org/stable/api/index.html#Makie

f = Figure()
ax = Axis(f[1,1])
for _ in 1:10
    lines!(ax, rand(5))
end
f

```

ps. I asked about `set_theme!` with font issue last week and feel confusing how I use it.

> [@How can I set the default font in Makie?](https://discourse.julialang.org/t/how-can-i-set-the-default-font-in-makie/95003):
>
> Main question Hi, I am new to Makie.jl for publication-quality vector graphics. I had tried below tutorial but I don’t get how set\_theme! function works. [https://docs.makie.org/stable/documentation/theming/index.html#theming](https://docs.makie.org/stable/documentation/theming/index.html#theming) For example, I understand that there is no optional argument font or fontfamily to change all fonts of a whole plot, but we could change one by one. In next plot, I changed the font of title to ‘computer modern’. using CairoMakie f = Figure() ax = Axis(f[1,1], titlefont …

Where I could learn about the function? API documentation is not helpful ☹ :

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

## Environment

- julia 1.8.5
- CairoMakie v0.10.2
- windows 11

---

<div class="post-metadata">

**Author:** ![RayleighLord](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rayleighlord/32/33592_2.png) [@RayleighLord](https://discourse.julialang.org/u/RayleighLord)\
**Post date:** [February 27, 2023, 9:19am UTC](https://discourse.julialang.org/t/how-to-change-default-color-theme-in-makie/95251/2 "2023-02-27T09:19:40Z")

</div>

Try this

```julia
using CairoMakie, LaTeXStrings

set_theme!(Theme(palette=(color=[:red, :blue, :green],),))

f = Figure()
ax = Axis(f[1, 1])
for _ in 1:3
    lines!(ax, rand(5))
end
f

```

For reference, I have a very basic [library](https://github.com/RayleighLord/Julianim.jl) (which I intend to expand to do scientific animations), where I have a few themes created that might be a good reference for you. In this [file](https://github.com/RayleighLord/Julianim.jl/blob/main/src/themes/plotting_themes.jl) I define the themes and in this other [file](https://github.com/RayleighLord/Julianim.jl/blob/main/scripts/plotgallery/journal_figures.jl) I make some basic plots.

Hopefully this clarifies it.

---

<div class="post-metadata">

**Author:** ![RayleighLord](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rayleighlord/32/33592_2.png) [@RayleighLord](https://discourse.julialang.org/u/RayleighLord)\
**Post date:** [February 27, 2023, 9:22am UTC](https://discourse.julialang.org/t/how-to-change-default-color-theme-in-makie/95251/3 "2023-02-27T09:22:35Z")

</div>

This also works

```julia
set_theme!(palette=(color=[:red, :blue, :green],))

```

Although if you remove the last comma you will get a conversion error.

---

<div class="post-metadata">

**Author:** ![rmsmsgood](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rmsmsgood/32/20544_2.png) [@rmsmsgood](https://discourse.julialang.org/u/rmsmsgood)\
**Post date:** [February 28, 2023, 1:27am UTC](https://discourse.julialang.org/t/how-to-change-default-color-theme-in-makie/95251/4 "2023-02-28T01:27:50Z")

</div>

Thank you but sadly I guess I can’t use Makie based libraries. I wonder how do you learn and used to it. Even in your just two answers, I don’t get what exactly they different and why my trials were wrong. Structure `Theme` seems to be essential, but not in some examples as you shown. Maybe I can overcome these some problems by asking but I can’t write my own codes if I don’t understand the fundamental grammer of Makie.

---

<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:** [February 28, 2023, 3:52pm UTC](https://discourse.julialang.org/t/how-to-change-default-color-theme-in-makie/95251/5 "2023-02-28T15:52:44Z")

</div>

Maybe have a look at how the default theme is defined:

> <https://github.com/MakieOrg/Makie.jl/blob/master/src/theming.jl#L18-L27>

I get that it’s frustrating to try many things and nothing works, however, Makie would be magic if it just did whatever people think of trying 🙂 Yes, everything could be documented better, but given our limited time, we can’t do that at once for every last aspect of the library (it’s pretty big).

There are several “palettes” in the default theme, each of these is meant to be used by Cyclers. And there are both `color` and `patchcolor` entries because sometimes people want different defaults for polygons (usually because they want them slightly transparent). Lines, scatter, text etc all use `color`, pretty much only `poly` and derivations of it like `barplot` use `patchcolor`.

---

<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:** [February 28, 2023, 3:54pm UTC](https://discourse.julialang.org/t/how-to-change-default-color-theme-in-makie/95251/6 "2023-02-28T15:54:44Z")

</div>

> [@rmsmsgood](#):
>
> I wonder how do you learn and used to it.

Exactly how you’re doing it, asking people if you can’t figure it out yourself using the documentation and the source code. And ideally, contributing back to the documentation afterwards, this way for the next person after you everything will be a little easier to understand.
