diff options
author | 2020-03-31 16:41:07 -0500 | |
---|---|---|
committer | 2020-04-24 15:13:22 -0500 | |
commit | e926e4374242cc590ac507b059e3ce0cfa97d52f (patch) | |
tree | 4d056fa2aa7fd9c0c765b088cc88c1b8e0da918a /core | |
parent | 9a4ad3d6a7de5305cc992b140ca208a4277f75ea (diff) | |
download | iced-e926e4374242cc590ac507b059e3ce0cfa97d52f.tar.gz iced-e926e4374242cc590ac507b059e3ce0cfa97d52f.tar.bz2 iced-e926e4374242cc590ac507b059e3ce0cfa97d52f.zip |
Add const from_rgba, for RGBA initialization
Diffstat (limited to 'core')
-rw-r--r-- | core/src/color.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/core/src/color.rs b/core/src/color.rs index b7445a8c..4f0d974b 100644 --- a/core/src/color.rs +++ b/core/src/color.rs @@ -65,7 +65,14 @@ impl Color { /// /// [`Color`]: struct.Color.html pub const fn from_rgb(r: f32, g: f32, b: f32) -> Color { - Color { r, g, b, a: 1.0 } + Color::from_rgba(r, g, b, 1.0f32) + } + + /// Creates a [`Color`] from its RGBA components. + /// + /// [`Color`]: struct.Color.html + pub const fn from_rgba(r: f32, g: f32, b: f32, a: f32) -> Color { + Color { r, g, b, a } } /// Creates a [`Color`] from its RGB8 components. |