bevy/crates
ickshonpe 45a3f3d138
Color interpolation in OKLab, OKLCH spaces for UI gradients (#19330)
# Objective

Add support for interpolation in OKLab and OKLCH color spaces for UI
gradients.

## Solution
* New `InterpolationColorSpace` enum with `OkLab`, `OkLch`, `OkLchLong`,
`Srgb` and `LinearRgb` variants.
  * Added a color space specialization to the gradients pipeline.
* Added support for interpolation in OkLCH and OkLAB color spaces to the
gradients shader. OKLCH interpolation supports both short and long hue
paths. This is mostly based on the conversion functions from
`bevy_color` except that interpolation in polar space uses radians.
  * Added `color_space` fields to each gradient type.

## Testing

The `gradients` example has been updated to demonstrate the different
color interpolation methods.
Press space to cycle through the different options.

---

## Showcase


![color_spaces](https://github.com/user-attachments/assets/e10f8342-c3c8-487e-b386-7acdf38d638f)
2025-06-21 15:06:35 +00:00
..
bevy_a11y Event Split: Event, EntityEvent, and BufferedEvent (#19647) 2025-06-15 16:46:34 +00:00
bevy_animation Event Split: Event, EntityEvent, and BufferedEvent (#19647) 2025-06-15 16:46:34 +00:00
bevy_anti_aliasing Let query items borrow from query state to avoid needing to clone (#15396) 2025-06-16 21:05:41 +00:00
bevy_app Event Split: Event, EntityEvent, and BufferedEvent (#19647) 2025-06-15 16:46:34 +00:00
bevy_asset deny(missing_docs) for bevy_asset_macros (#19719) 2025-06-19 02:02:39 +00:00
bevy_audio Fix iOS simulator build (#19498) 2025-06-10 17:01:37 +00:00
bevy_color Make sequential_dispersed fn constant (#19659) 2025-06-15 16:56:07 +00:00
bevy_core_pipeline rename Transform::compute_matrix to to_matrix (#19646) 2025-06-18 05:37:25 +00:00
bevy_core_widgets Core Checkbox (#19665) 2025-06-20 16:37:18 +00:00
bevy_derive bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_dev_tools Event Split: Event, EntityEvent, and BufferedEvent (#19647) 2025-06-15 16:46:34 +00:00
bevy_diagnostic bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_dylib bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_ecs Fix issue 19734: add dependency on bevy_utils for the bevy_ecs test. (#19738) 2025-06-21 15:05:04 +00:00
bevy_encase_derive bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_gilrs Make GILRS and WINIT_WINDOWS public (#19575) 2025-06-12 20:05:00 +00:00
bevy_gizmos Let query items borrow from query state to avoid needing to clone (#15396) 2025-06-16 21:05:41 +00:00
bevy_gltf Allow users to fix glTF coordinate system imports (#19633) 2025-06-16 21:47:34 +00:00
bevy_image Add missing docs for ImageLoader (#19499) 2025-06-09 19:46:33 +00:00
bevy_input Add support for ButtonInput<Key> (#19684) 2025-06-18 20:15:03 +00:00
bevy_input_focus Let query items borrow from query state to avoid needing to clone (#15396) 2025-06-16 21:05:41 +00:00
bevy_internal ECS: put strings only used for debug behind a feature (#19558) 2025-06-18 20:15:25 +00:00
bevy_log Revert "bevy_log: refactor how log layers are wired together (#19248)" (#19705) 2025-06-17 20:41:30 +00:00
bevy_macro_utils bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_math Improve Bevy's double-precision story for third-party crates (#19194) 2025-06-08 02:02:47 +00:00
bevy_mesh Initial raytraced lighting progress (bevy_solari) (#19058) 2025-06-12 21:26:10 +00:00
bevy_mikktspace deny(missing_docs) for bevy_mikktspace (#19654) 2025-06-15 16:50:23 +00:00
bevy_pbr rename Transform::compute_matrix to to_matrix (#19646) 2025-06-18 05:37:25 +00:00
bevy_picking rename GlobalTransform::compute_matrix to to_matrix (#19643) 2025-06-17 18:37:26 +00:00
bevy_platform bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_ptr bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_reflect Register ReflectSerialize for &'static str (#19680) 2025-06-16 22:09:15 +00:00
bevy_remote Schema types metadata (#19524) 2025-06-20 17:07:16 +00:00
bevy_render Remove 's lifetime from WorldQuery::Fetch (#19720) 2025-06-19 00:58:21 +00:00
bevy_scene ECS: put strings only used for debug behind a feature (#19558) 2025-06-18 20:15:25 +00:00
bevy_solari rename GlobalTransform::compute_matrix to to_matrix (#19643) 2025-06-17 18:37:26 +00:00
bevy_sprite Let query items borrow from query state to avoid needing to clone (#15396) 2025-06-16 21:05:41 +00:00
bevy_state Fix SubStates with multiple source states not reacting to all source changes (#19595) 2025-06-16 21:34:22 +00:00
bevy_tasks Added async_executor to the array of features enabled by multi_threaded within bevy_tasks crate to prevent compile-time error when default-features are disabled. (#19334) 2025-06-10 00:54:46 +00:00
bevy_text Adding PartialEq to some UI and Text types (#19552) 2025-06-09 20:08:17 +00:00
bevy_time Event Split: Event, EntityEvent, and BufferedEvent (#19647) 2025-06-15 16:46:34 +00:00
bevy_transform rename Transform::compute_matrix to to_matrix (#19646) 2025-06-18 05:37:25 +00:00
bevy_ui Color interpolation in OKLab, OKLCH spaces for UI gradients (#19330) 2025-06-21 15:06:35 +00:00
bevy_utils ECS: put strings only used for debug behind a feature (#19558) 2025-06-18 20:15:25 +00:00
bevy_window Gate Reflect derive behind feature flag (#19745) 2025-06-19 21:58:17 +00:00
bevy_winit Split CursorOptions off of Window (#19668) 2025-06-17 20:20:13 +00:00