Crayons.jl icon indicating copy to clipboard operation
Crayons.jl copied to clipboard

Detecting true color

Open cstjean opened this issue 8 years ago • 3 comments

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.

cstjean avatar Aug 07 '17 10:08 cstjean

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 avatar Aug 11 '17 12:08 KristofferC

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

KristofferC avatar Aug 12 '17 11:08 KristofferC

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

KristofferC avatar Sep 10 '17 01:09 KristofferC