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

The ENV checking in `print` could be expensive

Open KristofferC opened this issue 5 years ago • 0 comments

I designed that API when I was young and naive (... or something). What I am talking about is:

Alternatively, if the environment variable FORCE_COLOR exist, or Crayons.force_color(::Bool) has been enabled, color sequences are printed no matter what. Also, since relatively few terminals support full 24-bit colors, it is possible to activate 256 color mode which converts the 24-bit crayon to a 256 color crayon when printed. This is done by either defining the variable environment FORCE_256_COLORS or by calling Crayons.force_256_colors(::Bool). In addition, some systems have problems even with 256 colors, it is possible to convert to one of the 16 system colors by defining the variable FORCE_SYSTEM_COLORS or by calling Crayons.force_system_colors(::Bool).

These env variables are checked every time a Crayon is printed which is a system call etc. Should probablt deprecate these and figure out some other way of doing it.

KristofferC avatar Aug 31 '20 08:08 KristofferC