I am creating a color class, and I want to add additional operations (color, percent) and less (color, percent). This requires the ability to add and subtract colors, and it's hard for me to do arithmetic. How to use RGB or HSB (HSV) or HEX to perform operations such as:
Operation - echo color('blue')->more('yellow', 100%);
or
Operation - echo color('blue')->more('yellow', 50%);
- blue +.5 * yellow = dark green
For subtraction, I have a very vague idea about this:
Operation - echo color('orange-yellow')->less('red', 50%);
- orange yellow -.5 * red = yellow
EDIT:
Alright, thanks for your input. I tried to add CYM to each other, unfortunately, in red (255, 0, 0) ~ = (0, 1, 1) in CYM, and then if you add this in blue (0, 0, 255) ~ = (1 , 1, 0) it will be equal to (1, 2, 1) or (1, 1, 1), which is black in CYM.
Hue Saturation (HSB). , . , ( [0, 360]).
!
2:
, "" , .
HSB (Hue-Saturation-Brightness), , CYM . . , , , . HSB , , Photoshop, .
, , , , ! !
!
,
Matt