JuliaGraphics/ColorSchemes.jl

Feature request: Include the web-safe color palette

adrhill opened this issue · 6 comments

For some legacy fun, it would be nice to have access to the web-safe color palette.
The full color table can be found here.

Well, why not! 😃

using Colors, ColorSchemes

ColorScheme([parse(RGB, "#$(string(r, base=16))$(string(g, base=16))$(string(b, base=16))") 
        for r in 0x0:3:0xf for g in 0x0:3:0xf for b in 0x0:3:0xf])

Screenshot 2021-09-14 at 11 25 02

Is this a useful order, or would another order be better?

That's a cool one-liner!
The ordering looks good to me too. :)

You could code-golf this even further as

ColorScheme([parse(RGB, "#$(string.([r,g,b], base=16)...)") for r in 0x0:3:0xf for g in 0x0:3:0xf for b in 0x0:3:0xf])

at a small loss of performance.

Cool. Fortunately this package isn't smart enough to generate the schemes in code 😄

added in f7d43fe

Thanks a lot!