summaryrefslogtreecommitdiff
path: root/src/config.rs
diff options
context:
space:
mode:
authorpml68 <contact@pml68.dev>2025-02-16 15:32:11 +0100
committerpml68 <contact@pml68.dev>2025-02-16 15:32:11 +0100
commiteea6c89ce603d452985581ebea3d42543142ab85 (patch)
tree3c71bd07cf2b99a5542ff19ce3207791a27810da /src/config.rs
parentrefactor: random stuff (diff)
downloadiced-builder-eea6c89ce603d452985581ebea3d42543142ab85.tar.gz
feat!: add name to `Theme`, `is_dark` -> `dark`
Diffstat (limited to '')
-rw-r--r--src/config.rs21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/config.rs b/src/config.rs
index 9d29af7..5569aae 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -79,13 +79,13 @@ impl Config {
let content = fs::read_to_string(entry.path()).await.ok()?;
let theme: Theme = toml::from_str(content.as_ref()).ok()?;
- let name = entry.path().file_stem()?.to_string_lossy().to_string();
- Some(theme.into_iced_theme(name))
+ Some(iced::Theme::from(theme))
};
+ let mut selected = Theme::default().into();
let mut all = iced::Theme::ALL.to_owned();
- let mut selected = iced::Theme::default();
+ all.push(Theme::default().into());
if theme_index(&theme_name, iced::Theme::ALL).is_some() {
selected = theme_from_str(None, &theme_name);
@@ -98,18 +98,11 @@ impl Config {
continue;
};
- let Some(file_name) = entry.file_name().to_str().map(String::from)
- else {
- continue;
- };
-
- if let Some(file_name) = file_name.strip_suffix(".toml") {
- if let Some(theme) = read_entry(entry).await {
- if file_name == theme_name {
- selected = theme.clone();
- }
- all.push(theme);
+ if let Some(theme) = read_entry(entry).await {
+ if theme.to_string() == theme_name {
+ selected = theme.clone();
}
+ all.push(theme);
}
}