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 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 | |
---|---|
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 | |
---|---|
How it appears in the terminal:
% I want to use mustard green...
% ... and steel gray colors