from colorspace import darken, lighten, swatchplot
= "#ff3322"
original = lighten(original, amount = 0.3, method = "relative", space = "HCL")
lighter = darken(original, amount = 0.3, method = "relative", space = "HCL")
darker
swatchplot([lighter, original, darker],= False, figsize = (6, 1)); show_names
Algorithmically Lighten Colors
Description
Takes one or multiple colors and adjust them sucht hat they apper lightened. See also: darken.
Usage
lighten(col, amount=0.1,
method='relative',
space='HCL', fixup=True)
Arguments
-
col
- color (or colors) to be manipulated. Can be a color object a palette object, or a str/list of str with valid hex colors.
-
amount
float
-
value between
[0., 1.]
with the amount the colors should be lightened. Defaults to0.1
. -
method
str
-
either
"relative"
(default) or"absolute"
. -
space
str
-
one of
"HCL"
or"HLS"
. Defaults to"HCL"
. -
fixup
bool
-
should colors which fall outside the defined RGB space be fixed (corrected)? Defaults to
True
.
Examples
Raises
-
TypeError
: Ifmethod
is not str. -
ValueError
: Ifmethod
is not one of"absolute"
or"relative"
. -
TypeError
: Ifspace
is not str. -
ValueError
: Ifspace
is not one of"HCL"
,"HLS"
, or"combined"
. -
TypeError
: If input 'col' is not among the one of the recognized objects. -
TypeError
: Iffixup
is not bool.