UI specific color enum
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 161
Description
## What problem does this solve or what need does it fill?
Bevy UI's visual components like `BackgroundColor`, `BorderColor`, `TextColor` and `ImageNode` only take a flat `Color` and there is nowhere to add support for other color effects.
Related #18139
## What solution would you like?
Replace the UI `Color` fields with a `UiColor` enum:
```rust
pub enum UiColor {
Color(Color),
/// Once gradients support is added
Gradient(Gradient),
}
```
`UiColor` would implement the `Color` conversion traits so that code like:
```rust
commands.spawn((Node::default(), BackgroundColor(ORANGE_200.into())));
```
would remain unchanged. And to draw a node with gradient you'd use:
```rust
commands.spawn((
Node::default(),
BackGroundColor(LinearGradient::to_left(vec![Color::WHITE.into(), ORANGE.into(), (BLUE_200.into(), Val::Px(50.)).into()]).into())
));
```
## What alternative(s) have you considered?
I don't see any viable alternatives.
## Additional context
Contributor guide
Assessment
This issue has not been assessed yet.