Skip to content

Commit

Permalink
Fix bevy_color migration issues
Browse files Browse the repository at this point in the history
  • Loading branch information
benfrankel committed Mar 3, 2024
1 parent ea716d9 commit 94e6deb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions crates/bevy_ui/src/ui_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1729,7 +1729,7 @@ impl Outline {
#[reflect(Component, Default)]
pub struct UiImage {
/// The tint color used to draw the image
pub color: LegacyColor,
pub color: Color,
/// Handle to the texture
pub texture: Handle<Image>,
/// Whether the image should be flipped along its x-axis
Expand All @@ -1748,7 +1748,7 @@ impl UiImage {

/// Set the color tint
#[must_use]
pub const fn with_color(mut self, color: LegacyColor) -> Self {
pub const fn with_color(mut self, color: Color) -> Self {
self.color = color;
self
}
Expand Down
2 changes: 1 addition & 1 deletion examples/stress_tests/many_buttons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ fn button_system(
) {
for (interaction, mut image, &IdleColor(idle_color)) in interaction_query.iter_mut() {
image.color = match interaction {
Interaction::Hovered => ORANGE_RED,
Interaction::Hovered => ORANGE_RED.into(),
_ => idle_color,
};
}
Expand Down
6 changes: 3 additions & 3 deletions examples/ui/display_and_visibility.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ where
padding: UiRect::axes(Val::Px(5.), Val::Px(1.)),
..Default::default()
},
image: UiImage::default().with_color(Color::BLACK.with_a(0.5)),
image: UiImage::default().with_color(Color::BLACK.with_alpha(0.5)),
..Default::default()
},
Target::<T>::new(target),
Expand Down Expand Up @@ -467,7 +467,7 @@ fn text_hover(
for (interaction, mut image, children) in button_query.iter_mut() {
match interaction {
Interaction::Hovered => {
image.color = Color::BLACK.with_a(0.6);
image.color = Color::BLACK.with_alpha(0.6);
for &child in children {
if let Ok(mut text) = text_query.get_mut(child) {
// Bypass change detection to avoid recomputation of the text when only changing the color
Expand All @@ -476,7 +476,7 @@ fn text_hover(
}
}
_ => {
image.color = Color::BLACK.with_a(0.5);
image.color = Color::BLACK.with_alpha(0.5);
for &child in children {
if let Ok(mut text) = text_query.get_mut(child) {
text.bypass_change_detection().sections[0].style.color =
Expand Down
6 changes: 3 additions & 3 deletions examples/ui/ui_texture_atlas.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! This example illustrates how to use `TextureAtlases` within ui
use bevy::{color::palettes::basic::YELLOW, prelude::*, winit::WinitSettings};
use bevy::{color::palettes::css::*, prelude::*, winit::WinitSettings};

fn main() {
App::new()
Expand Down Expand Up @@ -60,8 +60,8 @@ fn setup(
..default()
},
TextureAtlas::from(texture_atlas_handle),
BackgroundColor(LegacyColor::ANTIQUE_WHITE),
Outline::new(Val::Px(8.0), Val::ZERO, LegacyColor::CRIMSON),
BackgroundColor(ANTIQUE_WHITE.into()),
Outline::new(Val::Px(8.0), Val::ZERO, CRIMSON.into()),
));
parent.spawn(TextBundle::from_sections([
TextSection::new("press ".to_string(), text_style.clone()),
Expand Down

0 comments on commit 94e6deb

Please sign in to comment.