From fce89d0ffe36111cdbf42480c28e67811afb42e6 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 7 Jan 2020 01:17:32 +0100 Subject: Use constants for colors in `styling` example --- core/src/color.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'core/src') diff --git a/core/src/color.rs b/core/src/color.rs index d72651d9..d6bdd365 100644 --- a/core/src/color.rs +++ b/core/src/color.rs @@ -33,6 +33,13 @@ impl Color { a: 0.0, }; + /// Creates a [`Color`] from its RGB components. + /// + /// [`Color`]: struct.Color.html + pub const fn from_rgb(r: f32, g: f32, b: f32) -> Color { + Color { r, g, b, a: 1.0 } + } + /// Creates a [`Color`] from its RGB8 components. /// /// [`Color`]: struct.Color.html @@ -45,13 +52,6 @@ impl Color { } } - /// Creates a [`Color`] from its RGB components. - /// - /// [`Color`]: struct.Color.html - pub fn from_rgb(r: f32, g: f32, b: f32) -> Color { - Color { r, g, b, a: 1.0 } - } - /// Converts the [`Color`] into its linear values. /// /// [`Color`]: struct.Color.html -- cgit