Closed EricRovell closed 3 years ago
Hi @EricRovell! How are you?
It seems to me that mixing more than two colors is a pretty rare task (I have never had to do that in 13 years of frontend development).
I refer to CSS specs when I experience some doubt in ideas. CSS also contains a color-mixing method, and it mixes two colors — so I can assume that there is no need for a more powerful color mixing method — people who are smarter than me have already investigated the issue and realized mixing two colors is sufficient. https://www.w3.org/TR/css-color-5/#funcdef-color-mix
Also, don't forget that people can use chaining like
colord('blue').mix('red').mix('black') // dark purple
I see, I guess it is not worth the time then. Thank you for explanation, I will close the issue then! 🤔
I have reimplemented
mix
plugin in my project by studying your code. API seems so fine and simple thanks toCIE LAB
color space. But I was thinking that I would be very nice to have an ability to mix many colors at once.Right now I have got two possible scenarios: as new method or separate function just like
random()
utility. I think it would be fine to use an array of objects as arguments:But I am not sure what is better option. Am I right that if we implement the utility function approach it should be as separate bundle? And how it is better to implement this size-efficiently? Right now I do not have any idea, if you like the idea of mixing several colors I need some help with correct architecture.