summaryrefslogtreecommitdiff
path: root/src/appearance.rs
diff options
context:
space:
mode:
authorPolesznyák Márk László <116908301+pml68@users.noreply.github.com>2025-04-29 23:35:39 +0200
committerGitHub <noreply@github.com>2025-04-29 23:35:39 +0200
commitca50c308f0058af80e9125ba00a1349877169968 (patch)
tree38fbd5c78c90487e5b641f635d01c4a614ddfd44 /src/appearance.rs
parentMerge pull request #14 from pml68/dependabot/cargo/windows_exe_info-0.5.1 (diff)
parentstyle: `theme` -> `appearance` (diff)
downloadiced-builder-ca50c308f0058af80e9125ba00a1349877169968.tar.gz
Merge pull request #20 from pml68/feat/custom-theme
Diffstat (limited to 'src/appearance.rs')
-rw-r--r--src/appearance.rs46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/appearance.rs b/src/appearance.rs
new file mode 100644
index 0000000..78e782d
--- /dev/null
+++ b/src/appearance.rs
@@ -0,0 +1,46 @@
+use std::sync::Arc;
+
+use material_theme::Theme;
+
+pub fn iced_theme_from_str(theme_name: &str) -> iced::Theme {
+ match theme_name {
+ "Light" => iced::Theme::Light,
+ "Dark" => iced::Theme::Dark,
+ "Dracula" => iced::Theme::Dracula,
+ "Nord" => iced::Theme::Nord,
+ "Solarized Light" => iced::Theme::SolarizedLight,
+ "Solarized Dark" => iced::Theme::SolarizedDark,
+ "Gruvbox Light" => iced::Theme::GruvboxLight,
+ "Gruvbox Dark" => iced::Theme::GruvboxDark,
+ "Catppuccin Latte" => iced::Theme::CatppuccinLatte,
+ "Catppuccin Frappé" => iced::Theme::CatppuccinFrappe,
+ "Catppuccin Macchiato" => iced::Theme::CatppuccinMacchiato,
+ "Catppuccin Mocha" => iced::Theme::CatppuccinMocha,
+ "Tokyo Night" => iced::Theme::TokyoNight,
+ "Tokyo Night Storm" => iced::Theme::TokyoNightStorm,
+ "Tokyo Night Light" => iced::Theme::TokyoNightLight,
+ "Kanagawa Wave" => iced::Theme::KanagawaWave,
+ "Kanagawa Dragon" => iced::Theme::KanagawaDragon,
+ "Kanagawa Lotus" => iced::Theme::KanagawaLotus,
+ "Moonfly" => iced::Theme::Moonfly,
+ "Nightfly" => iced::Theme::Nightfly,
+ "Oxocarbon" => iced::Theme::Oxocarbon,
+ "Ferra" => iced::Theme::Ferra,
+ _ => iced::Theme::default(),
+ }
+}
+
+#[derive(Debug, Clone)]
+pub struct Appearance {
+ pub selected: Theme,
+ pub all: Arc<[Theme]>,
+}
+
+impl Default for Appearance {
+ fn default() -> Self {
+ Self {
+ selected: Theme::default(),
+ all: Theme::ALL.into(),
+ }
+ }
+}