Skip to content

Mixing of multiple colors #507

@facelessuser

Description

@facelessuser

CSS will be allowing the mix of multiple colors in CSS color 5. Currently, average() should allow the same behavior with premultiply enabled (the default), mainly when applied to rectangular spaces. It should be noted that percentage handling would need to be manually managed as average() approaches this by weights, but a wrapper could be added.

Averaging will not match cylindrical space multi-mixing as averaging applies a circular mean instead of applying traditional CSS interpolation logic. We could add an option to use CSS hue logic when averaging, and this would allow the same behavior.

What this doesn't allow is some of the extra carryforward/powerless logic that interpolation allows. You also can't use other interpolation logic, like continuous, or some external logic. Averaging is kind of its own thing. Adding such things could bog down averaging speed.

It may be better to just add an alternate multi-mixing path that taps into interpolation plugins and handles the overhead of carryforward/powerless. It is less likely that someone would feed in an entire image's worth of pixels to multi-mix as it would for averaging. Doing this, I think it would be wise to at least add some mulit-mixing hooks so that interpolation approaches could optimize the mixing process. Internally, it expects 2 more colors to be processed as a gradient, not to all be mixed together. You also can't create an interpolation object that can multi-mix more than one color in a gradual progression. It may be nice to weight different mixtures and then apply a percentage that gives you a color at at a certain mixture of the process: 0 being unmixed and 1 being fully mixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions