a second object that can be converted into a palette. Must have the same number of colors as the argument on color1.
wherestr
The color space where the mixing is to take place, either "RGB" or "CIEXYZ".
Examples
from colorspace.colorlib import RGBfrom colorspace.colorlib import hexcolsfrom colorspace import*# Mixing two colors defined in the RGB space# via colorspace.colorlib.RGB. Mixing half-half# in the RGB color space (M1) and in the HCL space (M2).RGB_1 = RGB(R =1, G =0, B =0)RGB_2 = RGB(R =0, G =1, B =0)RGB_M1 = mixcolor(0.5, RGB_1, RGB_2, "sRGB")RGB_M1
sRGB color object (1 colors)
R G B
1: 0.50 0.50 0.00
# Mixing via XYZ color spaceRGB_M2 = mixcolor(0.5, RGB_1, RGB_2, "CIEXYZ")RGB_M2
CIEXYZ color object (1 colors)
X Y Z
1: 38.50 46.39 6.93
# Mixing two lists of hex-colors of length 5.# Mixing takes place once in the RGB color space (M1)# and once in the HCL color space (M2)HEX_1 = diverging_hcl()(5)HEX_2 = diverging_hcl(rev =True)(5)HEX_M1 = mixcolor(0.2, HEX_1, HEX_2, "sRGB")HEX_M1
sRGB color object (5 colors)
R G B
1: 0.12 0.20 0.56
0.66 0.64 0.76
0.89 0.89 0.89
0.76 0.62 0.67
0.45 0.07 0.31
# Mixing via XYZ color spaceHEX_M2 = mixcolor(0.8, HEX_1, HEX_2, "CIEXYZ")HEX_M2
CIEXYZ color object (5 colors)
X Y Z
1: 11.33 6.22 11.03
42.11 39.02 44.33
72.28 76.05 82.80
39.59 39.02 56.17
9.28 6.27 30.02
# Mixing objects of different length and type# Coordinates of the shorter object (RGB_1) will be recycled# to the same number of colors as in the longer object (HEX_2)RES_1 = mixcolor(0.2, RGB_1, HEX_2, "sRGB")RES_1.colors()