Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI specific color enum #18152

Open
ickshonpe opened this issue Mar 4, 2025 · 0 comments
Open

UI specific color enum #18152

ickshonpe opened this issue Mar 4, 2025 · 0 comments
Labels
C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled

Comments

@ickshonpe
Copy link
Contributor

ickshonpe commented Mar 4, 2025

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:

pub enum UiColor {
    Color(Color),
    /// Once gradients support is added
    Gradient(Gradient),
}

UiColor would implement the Color conversion traits so that code like:

commands.spawn((Node::default(), BackgroundColor(ORANGE_200.into())));

would remain unchanged. And to draw a node with gradient you'd use:

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

@ickshonpe ickshonpe added C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled labels Mar 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled
Projects
None yet
Development

No branches or pull requests

1 participant