diff options
author | 2024-02-03 23:49:56 +0530 | |
---|---|---|
committer | 2024-02-11 02:50:35 +0100 | |
commit | 3513a4ad5612b6659ab037b0c1b0c22e5cabc1f5 (patch) | |
tree | 467d62d7dd54b6ed3d8b98c6cbe0e4da263a6031 /style | |
parent | 33066bca1af6c67e5188c0481403f28afabcbe1f (diff) | |
download | iced-3513a4ad5612b6659ab037b0c1b0c22e5cabc1f5.tar.gz iced-3513a4ad5612b6659ab037b0c1b0c22e5cabc1f5.tar.bz2 iced-3513a4ad5612b6659ab037b0c1b0c22e5cabc1f5.zip |
add catppuccin themes
Diffstat (limited to 'style')
-rw-r--r-- | style/src/theme.rs | 26 | ||||
-rw-r--r-- | style/src/theme/palette.rs | 60 |
2 files changed, 86 insertions, 0 deletions
diff --git a/style/src/theme.rs b/style/src/theme.rs index 235aecbd..ad95ff0f 100644 --- a/style/src/theme.rs +++ b/style/src/theme.rs @@ -48,6 +48,14 @@ pub enum Theme { GruvboxLight, /// The built-in Gruvbox Dark variant. GruvboxDark, + /// The built-in Catppuccin Latte variant. + CatppuccinLatte, + /// The built-in Catppuccin Frappé variant. + CatppuccinFrappe, + /// The built-in Catppuccin Macchiato variant. + CatppuccinMacchiato, + /// The built-in Catppuccin Mocha variant. + CatppuccinMocha, /// A [`Theme`] that uses a [`Custom`] palette. Custom(Arc<Custom>), } @@ -63,6 +71,10 @@ impl Theme { Self::SolarizedDark, Self::GruvboxLight, Self::GruvboxDark, + Self::CatppuccinLatte, + Self::CatppuccinFrappe, + Self::CatppuccinMacchiato, + Self::CatppuccinMocha, ]; /// Creates a new custom [`Theme`] from the given [`Palette`]. @@ -91,6 +103,10 @@ impl Theme { Self::SolarizedDark => Palette::SOLARIZED_DARK, Self::GruvboxLight => Palette::GRUVBOX_LIGHT, Self::GruvboxDark => Palette::GRUVBOX_DARK, + Self::CatppuccinLatte => Palette::CATPPUCCIN_LATTE, + Self::CatppuccinFrappe => Palette::CATPPUCCIN_FRAPPE, + Self::CatppuccinMacchiato => Palette::CATPPUCCIN_MACCHIATO, + Self::CatppuccinMocha => Palette::CATPPUCCIN_MOCHA, Self::Custom(custom) => custom.palette, } } @@ -106,6 +122,12 @@ impl Theme { Self::SolarizedDark => &palette::EXTENDED_SOLARIZED_DARK, Self::GruvboxLight => &palette::EXTENDED_GRUVBOX_LIGHT, Self::GruvboxDark => &palette::EXTENDED_GRUVBOX_DARK, + Self::CatppuccinLatte => &palette::EXTENDED_CATPPUCCIN_LATTE, + Self::CatppuccinFrappe => &palette::EXTENDED_CATPPUCCIN_FRAPPE, + Self::CatppuccinMacchiato => { + &palette::EXTENDED_CATPPUCCIN_MACCHIATO + } + Self::CatppuccinMocha => &palette::EXTENDED_CATPPUCCIN_MOCHA, Self::Custom(custom) => &custom.extended, } } @@ -122,6 +144,10 @@ impl fmt::Display for Theme { Self::SolarizedDark => write!(f, "Solarized Dark"), Self::GruvboxLight => write!(f, "Gruvbox Light"), Self::GruvboxDark => write!(f, "Gruvbox Dark"), + Self::CatppuccinLatte => write!(f, "Catppuccin Latte"), + Self::CatppuccinFrappe => write!(f, "Catppuccin Frappé"), + Self::CatppuccinMacchiato => write!(f, "Catppuccin Macchiato"), + Self::CatppuccinMocha => write!(f, "Catppuccin Mocha"), Self::Custom(custom) => custom.fmt(f), } } diff --git a/style/src/theme/palette.rs b/style/src/theme/palette.rs index d5a1a5d9..cb5fc048 100644 --- a/style/src/theme/palette.rs +++ b/style/src/theme/palette.rs @@ -133,6 +133,50 @@ impl Palette { success: color!(0x98971a), // dark GREEN_2 danger: color!(0xcc241d), // dark RED_1 }; + + /// The built-in Catppuccin Latte variant of a [`Palette`]. + /// + /// Source: https://github.com/catppuccin/catppuccin + pub const CATPPUCCIN_LATTE: Self = Self { + background: color!(0xeff1f5), // Base + text: color!(0x4c4f69), // Text + primary: color!(0x1e66f5), // Blue + success: color!(0x40a02b), // Green + danger: color!(0xd20f39), // Red + }; + + /// The built-in Catppuccin Frappé variant of a [`Palette`]. + /// + /// Source: https://github.com/catppuccin/catppuccin + pub const CATPPUCCIN_FRAPPE: Self = Self { + background: color!(0x303446), // Base + text: color!(0xc6d0f5), // Text + primary: color!(0x8caaee), // Blue + success: color!(0xa6d189), // Green + danger: color!(0xe78284), // Red + }; + + /// The built-in Catppuccin Macchiato variant of a [`Palette`]. + /// + /// Source: https://github.com/catppuccin/catppuccin + pub const CATPPUCCIN_MACCHIATO: Self = Self { + background: color!(0x24273a), // Base + text: color!(0xcad3f5), // Text + primary: color!(0x8aadf4), // Blue + success: color!(0xa6da95), // Green + danger: color!(0xed8796), // Red + }; + + /// The built-in Catppuccin Mocha variant of a [`Palette`]. + /// + /// Source: https://github.com/catppuccin/catppuccin + pub const CATPPUCCIN_MOCHA: Self = Self { + background: color!(0x1e1e2e), // Base + text: color!(0xcdd6f4), // Text + primary: color!(0x89b4fa), // Blue + success: color!(0xa6e3a1), // Green + danger: color!(0xf38ba8), // Red + }; } /// An extended set of colors generated from a [`Palette`]. @@ -184,6 +228,22 @@ pub static EXTENDED_GRUVBOX_LIGHT: Lazy<Extended> = pub static EXTENDED_GRUVBOX_DARK: Lazy<Extended> = Lazy::new(|| Extended::generate(Palette::GRUVBOX_DARK)); +/// The built-in Catppuccin Latte variant of an [`Extended`] palette. +pub static EXTENDED_CATPPUCCIN_LATTE: Lazy<Extended> = + Lazy::new(|| Extended::generate(Palette::CATPPUCCIN_LATTE)); + +/// The built-in Catppuccin Frappé variant of an [`Extended`] palette. +pub static EXTENDED_CATPPUCCIN_FRAPPE: Lazy<Extended> = + Lazy::new(|| Extended::generate(Palette::CATPPUCCIN_FRAPPE)); + +/// The built-in Catppuccin Macchiato variant of an [`Extended`] palette. +pub static EXTENDED_CATPPUCCIN_MACCHIATO: Lazy<Extended> = + Lazy::new(|| Extended::generate(Palette::CATPPUCCIN_MACCHIATO)); + +/// The built-in Catppuccin Mocha variant of an [`Extended`] palette. +pub static EXTENDED_CATPPUCCIN_MOCHA: Lazy<Extended> = + Lazy::new(|| Extended::generate(Palette::CATPPUCCIN_MOCHA)); + impl Extended { /// Generates an [`Extended`] palette from a simple [`Palette`]. pub fn generate(palette: Palette) -> Self { |