diff options
author | 2025-01-27 01:27:26 +0100 | |
---|---|---|
committer | 2025-01-27 01:27:26 +0100 | |
commit | da1726b134ae084dd76b9e0a1107a771f69ed7c9 (patch) | |
tree | e107cea585febbf265105662b6fc564a23aaf845 /core/src/theme | |
parent | 3dc601415dc08bea4376cf92ecf7de3a0f0ba5ff (diff) | |
parent | 81f05f00c2f1a72567b057a8ace54860223b1248 (diff) | |
download | iced-da1726b134ae084dd76b9e0a1107a771f69ed7c9.tar.gz iced-da1726b134ae084dd76b9e0a1107a771f69ed7c9.tar.bz2 iced-da1726b134ae084dd76b9e0a1107a771f69ed7c9.zip |
Merge pull request #2749 from rhysd/const-from-rgb8
Make `Color::from_rgb8` and `Color::from_rgba8` const
Diffstat (limited to 'core/src/theme')
-rw-r--r-- | core/src/theme/palette.rs | 54 |
1 files changed, 9 insertions, 45 deletions
diff --git a/core/src/theme/palette.rs b/core/src/theme/palette.rs index 696c01d0..b69f99b1 100644 --- a/core/src/theme/palette.rs +++ b/core/src/theme/palette.rs @@ -29,56 +29,20 @@ impl Palette { pub const LIGHT: Self = Self { background: Color::WHITE, text: Color::BLACK, - primary: Color::from_rgb( - 0x5E as f32 / 255.0, - 0x7C as f32 / 255.0, - 0xE2 as f32 / 255.0, - ), - success: Color::from_rgb( - 0x12 as f32 / 255.0, - 0x66 as f32 / 255.0, - 0x4F as f32 / 255.0, - ), - warning: Color::from_rgb( - 0xFF as f32 / 255.0, - 0xC1 as f32 / 255.0, - 0x4E as f32 / 255.0, - ), - danger: Color::from_rgb( - 0xC3 as f32 / 255.0, - 0x42 as f32 / 255.0, - 0x3F as f32 / 255.0, - ), + primary: color!(0x5e7ce2), + success: color!(0x12664f), + warning: color!(0xffc14e), + danger: color!(0xc3423f), }; /// The built-in dark variant of a [`Palette`]. pub const DARK: Self = Self { - background: Color::from_rgb( - 0x20 as f32 / 255.0, - 0x22 as f32 / 255.0, - 0x25 as f32 / 255.0, - ), + background: color!(0x202225), text: Color::from_rgb(0.90, 0.90, 0.90), - primary: Color::from_rgb( - 0x5E as f32 / 255.0, - 0x7C as f32 / 255.0, - 0xE2 as f32 / 255.0, - ), - success: Color::from_rgb( - 0x12 as f32 / 255.0, - 0x66 as f32 / 255.0, - 0x4F as f32 / 255.0, - ), - warning: Color::from_rgb( - 0xFF as f32 / 255.0, - 0xC1 as f32 / 255.0, - 0x4E as f32 / 255.0, - ), - danger: Color::from_rgb( - 0xC3 as f32 / 255.0, - 0x42 as f32 / 255.0, - 0x3F as f32 / 255.0, - ), + primary: color!(0x5e7ce2), + success: color!(0x12664f), + warning: color!(0xffc14e), + danger: color!(0xc3423f), }; /// The built-in [Dracula] variant of a [`Palette`]. |