Skip to content

HSL Colors#

Disclaimer

Not all terminals support RGB, HSL, or Hex colors. If your terminal does support such advanced colors, read on.

Full Text Functions#

hsl(text, hue, saturation, lightness) #

Prints full line of custom HSL-colored text.

Parameters:

Name Type Description Default
text str

Text to be printed on colored background.

required
hue float

Number between 0 and 360 degrees.

required
saturation float

Percentage between 0 and 100 %.

required
lightness float

Percentage between 0 and 100 %.

required
Example
Python
1
2
3
from colorist import hsl

hsl("I want this text in green HSL colors", 120, 50, 50)

How it appears in the terminal:

% I want this text in green HSL colors

bg_hsl(text, hue, saturation, lightness) #

Prints full line of text on custom HSL-colored background.

Parameters:

Name Type Description Default
text str

Text to be printed on colored background.

required
hue float

Number between 0 and 360 degrees.

required
saturation float

Percentage between 0 and 100 %.

required
lightness float

Percentage between 0 and 100 %.

required
Example
Python
1
2
3
from colorist import bg_hsl

bg_hsl("I want this background in green HSL colors", 120, 50, 50)

How it appears in the terminal:

% I want this background in green HSL colors

Custom String Styling#

ColorHSL(hue, saturation, lightness)#

Class for custom HSL foreground text color.

Parameters:

Name Type Description Default
hue float

Number between 0 and 360 degrees.

required
saturation float

Percentage between 0 and 100 %.

required
lightness float

Percentage between 0 and 100 %.

required
Example
Python
1
2
3
4
5
from colorist import ColorHSL

mustard_green = ColorHSL(60, 56, 43)

print(f"I want to use {mustard_green}mustard green{mustard_green.OFF} color inside this paragraph")

How it appears in the terminal:

% I want to use mustard green color inside this paragraph

BgColorHSL(hue, saturation, lightness)#

Class for custom HSL background color.

Parameters:

Name Type Description Default
hue float

Number between 0 and 360 degrees.

required
saturation float

Percentage between 0 and 100 %.

required
lightness float

Percentage between 0 and 100 %.

required
Example
Python
1
2
3
4
5
from colorist import BgColorHSL

bg_steel_gray = BgColorHSL(190, 2, 49)

print(f"I want to use {bg_steel_gray}steel gray{bg_steel_gray.OFF} background color inside this paragraph")

How it appears in the terminal:

% I want to use steel gray background color inside this paragraph