bevy/crates/bevy_color
Alice Cecile 9ae5ba2e71
bevy_color::Color convenience methods (#12171)
# Objective

As suggested in #12163 by @cart, we should add convenience constructors
to `bevy_color::Color` to match the existing API (easing migration pain)
and generally improve ergonomics.

## Solution

- Add `const fn Color::rgba(red, green, blue, alpha)` and friends, which
directly construct the appropriate variant.
- Add `const fn Color::rgb(red, green, blue)` and friends, which impute
and alpha value of 1.0.
- Add `const BLACK, WHITE, NONE` to `Color`. These are stored in
`LinearRgba` to reduce pointless conversion costs and inaccuracy.
- Changed the default `Color` from `Srgba::WHITE` to the new linear
equivalent for the same reason.

---------

Co-authored-by: Alice Cecile <alice.i.cecil@gmail.com>
2024-02-28 00:14:21 +00:00
..
crates/gen_tests bevy_color: Add Laba to support Lab Color Model (#12115) 2024-02-26 22:30:50 +00:00
docs bevy_color: Added Color Conversion Mermaid Diagram (#12147) 2024-02-27 06:03:34 +00:00
src bevy_color::Color convenience methods (#12171) 2024-02-28 00:14:21 +00:00
Cargo.toml Use LinearRgba in bevy_gizmos internals (#12128) 2024-02-26 23:50:33 +00:00