# Makie legend text colours

**URL:** <https://discourse.julialang.org/t/makie-legend-text-colours/130572>\
**Category:** Visualization\
**Tags:** makie\
**Created:** [July 9, 2025, 8:36am UTC](https://discourse.julialang.org/t/makie-legend-text-colours/130572 "2025-07-09T08:36:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://avatars.discourse-cdn.com/v4/letter/a/258eb7/32.png) [@aris](https://discourse.julialang.org/u/aris)\
**Post date:** [July 9, 2025, 8:36am UTC](https://discourse.julialang.org/t/makie-legend-text-colours/130572/1 "2025-07-09T08:36:00Z")

</div>

Hello everyone,

Suppose we have the following example:

```julia
using GLMakie

f = Figure()
ax = Axis(f[:,:])

for i in 1:5 
    scatter!(
        ax, i, i,
        marker=collect('a':'z')[i],
        colormap=:tab10, colorrange=(1, 10), color=i,
        markersize = 15, label = "this is a label"
    )
end

axislegend(ax, position=:lt)

```

which generates this plot:

 ![mre](https://global.discourse-cdn.com/julialang/original/3X/6/8/68118b69749a37594bc36c4d909abfa9c583a3c2.png)

Is there a straightforward way to make the labels on the legend follow the same colours as the markers they correspond to?

---

<div class="post-metadata">

**Author:** ![asinghvi17](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/asinghvi17/32/8272_2.png) [@asinghvi17](https://discourse.julialang.org/u/asinghvi17)\
**Post date:** [July 9, 2025, 11:50am UTC](https://discourse.julialang.org/t/makie-legend-text-colours/130572/2 "2025-07-09T11:50:51Z")

</div>

You could pass `label = Makie.rich("this is a label", color = color_you_want)` instead, that should work. But you would have to get the color from the colormap manually.

---

<div class="post-metadata">

**Author:** ![aris](https://avatars.discourse-cdn.com/v4/letter/a/258eb7/32.png) [@aris](https://discourse.julialang.org/u/aris)\
**Post date:** [July 9, 2025, 12:06pm UTC](https://discourse.julialang.org/t/makie-legend-text-colours/130572/3 "2025-07-09T12:06:04Z")

</div>

Thanks @asinghvi17, didn’t know that rich text was an option.

edit: the following seems to do the job:

```julia
using GLMakie

f = Figure()
ax = Axis(f[:,:])

for i in 1:5 

    col = cgrad(:tab10)[i]
    scatter!(
        ax, i, i,
        marker=collect('a':'z')[i],
        color=col,
        markersize = 15, 
        label = Makie.rich("this is a label", color = col)
    )
end

axislegend(ax, position=:lt)

```
