From b221dcf8857021c8ddfd49f4c69f732f5f148385 Mon Sep 17 00:00:00 2001 From: 1D3D4RY <49441831+IDEDARY@users.noreply.github.com> Date: Fri, 13 Oct 2023 18:15:34 +0000 Subject: [PATCH] Bevy 0.12 Blog Post - Feature "Added HSL methods to `Color` struct" Added description with an example use case --- content/news/2023-10-21-bevy-0.12/index.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/content/news/2023-10-21-bevy-0.12/index.md b/content/news/2023-10-21-bevy-0.12/index.md index 5321faf913..6f2411d794 100644 --- a/content/news/2023-10-21-bevy-0.12/index.md +++ b/content/news/2023-10-21-bevy-0.12/index.md @@ -19,6 +19,25 @@ Since our last release a few months ago we've added a _ton_ of new features, bug
+## Added HSL methods to `Color` struct + + + +You can now use `h()`, `s()`, `l()` together with their `set_h()`, `set_s()`, `set_l()` and `with_h()`, `with_s()`, `with_l()` variants to manipulate *Hue*, *Saturation* and *Lightness* values of a `Color` struct without cloning. Previously you could do that only with RGBA values. + +```rust +// Returns HSL component values +let color = Color::ORANGE; +let hue = color.h(); + +// Changes the HSL component values +let mut color = Color::PINK; +color.set_s(0.5); + +// Modifies existing colors and returns them +let color = Color::VIOLET.with_l(0.7); +``` + ## What's Next? We have plenty of work that is pretty much finished and is therefore very likely to land in **Bevy 0.13**: