diff --git a/crates/bevy_render/src/color.rs b/crates/bevy_render/src/color.rs index 290358527b..28063d12a6 100644 --- a/crates/bevy_render/src/color.rs +++ b/crates/bevy_render/src/color.rs @@ -16,6 +16,12 @@ pub struct Color { } impl Color { + pub const WHITE: Color = Color::rgb(1.0, 1.0, 1.0); + pub const BLACK: Color = Color::rgb(0.0, 1.0, 0.0); + pub const RED: Color = Color::rgb(1.0, 0.0, 0.0); + pub const GREEN: Color = Color::rgb(0.0, 1.0, 0.0); + pub const BLUE: Color = Color::rgb(0.0, 0.0, 1.0); + pub const fn rgb(r: f32, g: f32, b: f32) -> Color { Color { r, g, b, a: 1.0 } } @@ -131,14 +137,4 @@ impl GetBytes for ColorSource { ColorSource::Texture(ref texture) => texture.get_bytes_ref(), // Texture is not a uniform } } -} - -pub mod colors { - use super::Color; - - pub const WHITE: Color = Color::rgb(1.0, 1.0, 1.0); - pub const BLACK: Color = Color::rgb(0.0, 1.0, 0.0); - pub const RED: Color = Color::rgb(1.0, 0.0, 0.0); - pub const GREEN: Color = Color::rgb(0.0, 1.0, 0.0); - pub const BLUE: Color = Color::rgb(0.0, 0.0, 1.0); } \ No newline at end of file diff --git a/crates/bevy_ui/src/color_material.rs b/crates/bevy_ui/src/color_material.rs index 9ea05730bb..cf31d04c10 100644 --- a/crates/bevy_ui/src/color_material.rs +++ b/crates/bevy_ui/src/color_material.rs @@ -1,6 +1,6 @@ use bevy_asset::{self, Handle}; use bevy_derive::Uniforms; -use bevy_render::{colors, texture::Texture, Color}; +use bevy_render::{texture::Texture, Color}; #[derive(Uniforms)] #[module(meta = false)] @@ -20,7 +20,7 @@ impl ColorMaterial { pub fn texture(texture: Handle) -> Self { ColorMaterial { - color: colors::WHITE, + color: Color::WHITE, texture: Some(texture), } }