KristofferC / Crayons.jl

Colored and styled strings for terminals.
Other
150 stars 14 forks source link

Detecting true color #15

Open cstjean opened 7 years ago

cstjean commented 7 years ago

I have a package where I show numbers with a red->green color gradient. Is there a function that returns whether 24-bit color is supported?

Alternatively, it would be neat if I could write Crayon(foreground=nearest_ansi_color(121,0,40))

BTW, the README needs to be updated, Crayons.test_256_colors(shownumbers::Bool=true) doesn't support keyword arguments.

KristofferC commented 7 years ago

I think it is in general hard to ask the terminal if it supports true color. I thought a bit about if a 24 bit -> 256 color converter makes sense in this package. I think ImageInTerminal.jl has one.

In Crayons.test_256_colors(shownumbers::Bool=true), shownumbers is not a keyword argument, it is just a label of the argument so that it explains what it does. Maybe it's confusing.

KristofferC commented 7 years ago

Ref: https://github.com/chalk/supports-color

KristofferC commented 7 years ago

There is now a function or ENV variable that can be set to have 24-bit Crayons print as 256 colored crayons.