How does Discourse generate random colors for categories?

(Frank) #1


How does Discourse generate those nice random colors for its categories? Is the color set in the database, stylesheet or JavaScript? It’d be great if someone could point me to the relevant place in the source code.

I tried with jquery-color but the result isn’t as nice:


(Daniel) #2

They are not generated but are set in the config file.

The default colours are:


(Frank) #3

Great, thanks!

Can you tell a little bit more about how they’re being applied to each category though?

(Kane York) #4

The admin picks the color in the category settings for each one; it included a free-text color entry box too.