Skip to content

Commit

Permalink
Bevy 0.12 Blog Post - Feature "Added HSL methods to Color struct"
Browse files Browse the repository at this point in the history
Added description with an example use case
  • Loading branch information
IDEDARY authored Oct 13, 2023
1 parent c1b6fc3 commit b221dcf
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions content/news/2023-10-21-bevy-0.12/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,25 @@ Since our last release a few months ago we've added a _ton_ of new features, bug

<div class="release-feature-authors">authors: @author</div>

## Added HSL methods to `Color` struct

<div class="release-feature-authors">authors: @idedary</div>

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);
```

## <a name="what-s-next"></a>What's Next?

We have plenty of work that is pretty much finished and is therefore very likely to land in **Bevy 0.13**:
Expand Down

0 comments on commit b221dcf

Please sign in to comment.