diff --git a/crates/bevy_pbr/src/pbr_material.rs b/crates/bevy_pbr/src/pbr_material.rs index 1d21348f29589..be166de2d1aad 100644 --- a/crates/bevy_pbr/src/pbr_material.rs +++ b/crates/bevy_pbr/src/pbr_material.rs @@ -747,6 +747,11 @@ impl StandardMaterial { self.flip(horizontal, vertical); self } + + /// Creates a new material from a given color + pub fn from_color(color: impl Into) -> Self { + Self::from(color.into()) + } } impl Default for StandardMaterial { diff --git a/crates/bevy_sprite/src/mesh2d/color_material.rs b/crates/bevy_sprite/src/mesh2d/color_material.rs index 78061ce06d0c6..38d74bb473b83 100644 --- a/crates/bevy_sprite/src/mesh2d/color_material.rs +++ b/crates/bevy_sprite/src/mesh2d/color_material.rs @@ -51,6 +51,13 @@ pub struct ColorMaterial { pub texture: Option>, } +impl ColorMaterial { + /// Creates a new material from a given color + pub fn from_color(color: impl Into) -> Self { + Self::from(color.into()) + } +} + impl Default for ColorMaterial { fn default() -> Self { ColorMaterial {