How to make a 24-bit ANSI color code with high intensity java

77 views Asked by At

I am trying to create a 24-bit ANSI color code as such : \033[38;5;red;green;bluem with high intensity enabled I know it is possible in 4-bit by adding 60 to the number ex.30 = FG black -> 90 = FG black high intensity, in 8-bit by doing \033[38;5;8;numberm but I do not know how to do it in 24-bit I searched all over the internet but still couldn't find how to do it.

1

There are 1 answers

0
Giacomo Catenazzi On BEST ANSWER

Note: not all terminals supports 24-bit colours, and as far I know it is far from being "ANSI". xterm (so the base/reference terminal for Linux) had some reserve on it, and it took many years to implement it.

In any case: brightness it not a flag, it is just a more bright colour, so a colour with higher RGB values. So the terminal white is in reality a light grey, and terminal bright white is white.

Wikipedia has a nice table about the different RGB values on different terminals (colours are not standardized): https://en.wikipedia.org/wiki/ANSI_escape_code#Colors , it helps to understand the "bright" model). From there you can see how you can have dark and bright colours (without going with HSV/HSL models). (Note: just scaling down RGB values, which start with a different level, will change the hue).