How to have multiple labelcolors in legend?

Hi,

is there a way to have to have more than one :labelcolor in a Legend() or axislegend()?
Specifically in my case, I am trying to make each label be the same color as the line it represents, like

plt.legend(labelcolor='linecolor')

in PyPlot.

I have tried the following

using CairoMakie
x = 1:0.01:10
y1 = x.^2
y2 = x.^3
fig = Figure()
ax = Axis(fig[1, 1])
lines!(ax, x, y1, color = :blue, label = "blue")
lines!(ax, x, y2, color = :red, label = "red")
axislegend(ax, position = :lt, labelcolor = [:blue, :red])
fig

But it seems that labelcolor is only allowed to be a single color(?).
Is there an easy way to do this or would I have to make a legend for each line and try to manually align them?

Maybe try label = rich("blue", color = :blue)

2 Likes