Closed data-man closed 3 years ago
I had a look at other implementations for this.
Here, it seems they just included the grey colors into the 256 colors and added that as a doc comment. What do you think @data-man ? Should there maybe exist a conversion function from greyscale to the appropiate values in the 256 colors?
@joachimschmidt557 I have another cool example :smile: https://github.com/rocketsman/colorful/blob/master/src/core/colors.rs#L266
I have checked many other implementations in different languages and noticed that some libraries outputs White (FG/BG Code 37/47) as 97/107. And White named as Grey.
I think it's correct.
https://en.wikipedia.org/wiki/ANSI_escape_code#Colors has pretty table for comparison.
Hmm, that example uses a large enum for the 256 colors which includes the shades of grey. Should we use that?
@joachimschmidt557
Should we use that?
Why not?
IMO Grey50
is easier to remember than RGB(128, 128, 128)
. And less typing. :)
I'm still waiting for your reply... :grinning:
Q:
Should we use that?
A:
Why not?
But the most important question is:
some libraries outputs White (FG/BG Code 37/47) as 97/107. And White named as Grey. I think it's correct.
Thoughts?
I have checked many other implementations in different languages and noticed that some libraries outputs White (FG/BG Code 37/47) as 97/107. And White named as Grey.
Ultimately, it's just a naming scheme. According to Wikipedia, 37 is also called white
and 97 is called bright white
. I think the name white
for 37 is okay.
Regarding the large enums for color names, this can be implemented, but I'd prefer a new file called color_names.zig
or similar where color names are mapped to the ANSI colors.
Ok! :)
but I'd prefer a new file called color_names.zig or similar where color names are mapped to the ANSI colors.
:+1:
Now we can create enums in comptime by @Type
. Just an idea...
Are you ok with other color representation? HSL, HSV, CMYK, ...
Are you ok with other color representation? HSL, HSV, CMYK, ...
I think stuff like this is out of scope for this library. The basic colors or the 8-bit colors can vary from terminal from terminal and even within one terminal users can have different color themes. Converting RGB (24-bit colors) into HSL, HSV, ... and vice versa should be the job of another library focusing on colors, color spaces, conversions and other color operations.
Another idea: rename it to GreyRGB and add 24 grayscale colors from 256-color palette (232-255 indexes).