Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editor: Add an OKLab colour picker #1816

Merged
merged 4 commits into from
Sep 8, 2021
Merged

Conversation

HybridDog
Copy link
Contributor

OkLab Colour Picker

I extended the colour picker in the level editor so that colours can be chosen in the perceptual OkLab colourspace (actually L, C, h and not L, a, b). The user can change the lightness, chroma or hue with the mouse or keyboard. The colour is gamut clipped to fit in sRGB.
Here's a video of the colour picker:

oklab_colour_picker.mp4

To Do

  • Test if there are bugs (I'm the only one who tested it so far)
  • Code style fixes if needed

Additional information

Hue Selection Gamut Clipping

I tried different gamut clipping methods for the hue selection:
hues_preserved_lightness
hues_project_to_adaptive_l0_l_cusp_0 5
hues_project_to_l_half
hues_preserved_chroma
The pictures correspond to following methods:

  • Preserve lightness
  • Adaptive L0, hue dependent, alpha=0.5 (currently implemented)
  • Project towards (L0, C0) = (0.5, 0)
  • Preserve chroma

Links

OkLab description: https://bottosson.github.io/posts/oklab/
Gamut clipping: https://bottosson.github.io/posts/gamutclipping/
I copied MIT-licensed code from there.

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.

2 participants