RGB Colors#
What are RGB Colors?#
The 24-bit RGB color model covers over 16 million colors, and each color can be defined as red, green, and blue:
| Channel | Red | Green | Blue |
|---|---|---|---|
| Allowed values | 0-255 | 0-255 | 0-255 |
Disclaimer
Not all terminals support 24-bit colors in RGB, HSL, or Hex. If your terminal does support such advanced colors, read on.
Full Line Text Functions#
Try the rgb() and bg_rgb() methods for a full line of colored text. The values for red, green, blue can be an integer between 0-255.
Example:
| Python | |
|---|---|
1 2 3 4 | |
How it appears in the terminal:
% I want this text in blue RGB colors
% I want this background in blue RGB colors Custom String Styling#
Or customize the styling of text and background with the ColorRGB() and BgColorRGB() classes:
| Python | |
|---|---|
1 2 3 4 5 6 7 | |
How it appears in the terminal:
% I want to use DUSTY PINK...
% ... and STEEL BLUE colors