Skip to content

Add parameter or different function for mixing colors in different color spaces #1109

@mxhvlm

Description

@mxhvlm

I'm using FlatLaf to modernize the theme for our Swing application. So far I really like the flexibility offered by the theme properties file format.

However, to my understanding from looking at the docs and code, the mix() function in the properties file always mixes colors in the RGB color space.

Mixing colors in RGB space does not always give the "expected" results: When mixing bright red and bright green, the expectation is to get a bright yellow. However mixing in RGB space yields a olive green instead:
50% Red = (255, 0, 0) + 50% Green = (0, 255, 0) => (128, 128, 0)

Therefore in design, colors are often mixed in hsl / oklab / etc.

Is there already an option to do this and I'm simply missing it in the docs / code? Has this topic already been considered?

If not, I suggest adding either a parameter or separate mixing functions to chose a specific color space when mixing colors.

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions