HSL Colors#
What are HSL Colors?#
The 24-bit HSL color model covers over 16 million colors, and each color can be defined as hue, saturation, and lightness:
| Parameter | Hue | Saturation | Lightness |
|---|---|---|---|
| Allowed values | 0-360 degrees | 0-100 % | 0-100 % |
| Description | Deegree on the color wheel. | Intensity of the color. | Brightness of the color. |
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#
You can output colors in HSL with the hsl() and bg_hsl() methods. The value for hue can be between 0-360 degrees, while saturation and lightness can be a percentage between 0-100 %:
Example:
| Python | |
|---|---|
1 2 3 4 | |
How it appears in the terminal:
% I want this text in green HSL colors
% I want this background in green HSL colors Custom String Styling#
Or customize the styling of text and background with the ColorHSL() and BgColorHSL() classes:
| Python | |
|---|---|
1 2 3 4 5 6 7 | |
How it appears in the terminal:
% I want to use MUSTARD GREEN...
% ... and STEEL GRAY colors