diff options
author | 2020-01-07 01:17:32 +0100 | |
---|---|---|
committer | 2020-01-07 01:17:32 +0100 | |
commit | fce89d0ffe36111cdbf42480c28e67811afb42e6 (patch) | |
tree | 8be6b80916034d63b3055f779a15324bfdb162c1 /core | |
parent | b329003c8fdcdc3378c8fda93af54be5686fc9ae (diff) | |
download | iced-fce89d0ffe36111cdbf42480c28e67811afb42e6.tar.gz iced-fce89d0ffe36111cdbf42480c28e67811afb42e6.tar.bz2 iced-fce89d0ffe36111cdbf42480c28e67811afb42e6.zip |
Use constants for colors in `styling` example
Diffstat (limited to 'core')
-rw-r--r-- | core/src/color.rs | 14 |
1 files changed, 7 insertions, 7 deletions
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 |