cachai.utilities.saturate_color
- cachai.utilities.saturate_color(color, factor=1.0)[source]
Adjusts the saturation level of an RGB color by a specified factor.
- Parameters
- color
tupleorarray-like Triplet with the three RGB values (in arithmetic notation, i.e. 0.0 to 1.0)
- factor
float Saturation factor. 1.0 means no change.
- color
- Returns
tuple: RGB color
Examples
import cachai.utilities as chu import matplotlib.colors as mcolors # matplotlib.colors.to_rgb also supports HEX codes my_color = mcolors.to_rgb("violet") # Saturate to 150% new_color = chu.saturate_color(my_color,factor=1.5) print("my_color:",my_color) print("new_color:",new_color)
my_color: (0.9333333333333333, 0.5098039215686274, 0.9333333333333333) new_color: (1.0, 0.44313725490196076, 0.9999999999999999)