Skip to content

Color Spaces for mixing colors - #1132

Open
DevCharly wants to merge 2 commits into
mainfrom
color-spaces
Open

Color Spaces for mixing colors#1132
DevCharly wants to merge 2 commits into
mainfrom
color-spaces

Conversation

@DevCharly

Copy link
Copy Markdown
Collaborator

This PR adds support for Oklab and linear sRGB color spaces to color functions mix(), tint() and shade(). (issue #1109)
It also adds preview for color functions to FlatLaf Theme Editor.

Color Spaces

To use Oklab or linear sRGB color spaces in color functions mix(), tint() and shade(),
pass oklab or lrgb as last parameter:

mix(#f00,#0f0,40%,lrgb)
mix(#f00,#0f0,40%,oklab)

tint(#f00,40%,lrgb)
tint(#f00,40%,oklab)

shade(#f00,20%,lrgb)
shade(#f00,20%,oklab)

Following screenshot shows some differences between the color spaces:

grafik

Color Function Preview in FlatLaf Theme Editor

If the editor cursor is at a color function, a preview of the result and the whole percentage range is shown at the bottom of the "Preview" area. This makes it easier to choose a good percentage value and color space.

grafik

The color function is shown at top.
Then the initial color and the resulting color (with percentage).
The bottom gradient shows the color function result in range from 0% to 100%.

grafik grafik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant