Colored output term

Berlin and Kay found that, in languages with fewer than the maximum eleven color categories, the colors followed a specific evolutionary pattern. - Using terminal color code

List of ANSI color escape sequences

Ruby

## 24 Grayscale
(232..255).each { |l| 
    print "\033[48;5;#{l}m  "
}
puts "done"

C++

## RGB colors
auto s = std::format("\033[38;2;{;d};{;d};{:d}m ", r,g,b);    // Select RGB foreground color

caption

Written on December 10, 2022, Last update on September 15, 2024
c++ ruby color term cli