You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add oklch() color function and to-oklch() method (#10431)
* Add oklch() color function and to-oklch() method
Add support for the Oklch perceptually uniform color space:
- Add oklch(lightness, chroma, hue, alpha?) global function
- Add color.to-oklch() method returning {lightness, chroma, hue, alpha}
- Add C++ API: OklchColor struct, Color::from_oklch(), Color::to_oklch()
- Add FFI functions: slint_color_from_oklch, slint_color_to_oklch
- Add interpreter and LSP preview support
- Add documentation and tests
* Add Wikipedia link for Oklch color space in documentation
* Add percentage and angle support for oklch() parameters
- Lightness can be specified as percentage (0% to 100%)
- Chroma can be specified as percentage (0% to 100%, where 100% = 0.4)
- Hue can be specified as angle (e.g., 180deg, 0.5turn)
* Add angle support for hsv() hue parameter
The hue parameter can now be specified as an angle (e.g., 240deg, 1turn)
in addition to a plain float value.
* Fix alignment in C++ slint_color.h to_oklch method
Converts this color to the [Oklch color space](https://en.wikipedia.org/wiki/Oklab_color_space) and returns a struct with the `lightness`, `chroma`, `hue`,
121
+
and `alpha` fields. `lightness` is between 0 and 1, `chroma` is typically between 0 and ~0.4,
122
+
`hue` is between 0 and 360, and `alpha` is between 0 and 1.
123
+
108
124
## Linear Gradients
109
125
110
126
Linear gradients describe smooth, colorful surfaces. They're specified using an angle and a series of
0 commit comments