fix(appearance): apply density to both themes
This commit is contained in:
parent
8097fc57b0
commit
174a352d78
1 changed files with 10 additions and 11 deletions
|
|
@ -13,7 +13,7 @@ use cosmic::config::CosmicTk;
|
||||||
use cosmic::cosmic_config::{Config, ConfigSet, CosmicConfigEntry};
|
use cosmic::cosmic_config::{Config, ConfigSet, CosmicConfigEntry};
|
||||||
use cosmic::cosmic_theme::palette::{FromColor, Hsv, Srgb, Srgba};
|
use cosmic::cosmic_theme::palette::{FromColor, Hsv, Srgb, Srgba};
|
||||||
use cosmic::cosmic_theme::{
|
use cosmic::cosmic_theme::{
|
||||||
CornerRadii, Density, Theme, ThemeBuilder, ThemeMode, DARK_THEME_BUILDER_ID,
|
CornerRadii, Density, Spacing, Theme, ThemeBuilder, ThemeMode, DARK_THEME_BUILDER_ID,
|
||||||
LIGHT_THEME_BUILDER_ID,
|
LIGHT_THEME_BUILDER_ID,
|
||||||
};
|
};
|
||||||
use cosmic::iced_core::{alignment, Background, Color, Length};
|
use cosmic::iced_core::{alignment, Background, Color, Length};
|
||||||
|
|
@ -681,18 +681,17 @@ impl Page {
|
||||||
_ = config.set("header_size", density);
|
_ = config.set("header_size", density);
|
||||||
}
|
}
|
||||||
|
|
||||||
let Some(config) = self.theme_builder_config.as_ref() else {
|
let spacing: Spacing = density.into();
|
||||||
return Command::none();
|
|
||||||
};
|
|
||||||
|
|
||||||
let spacing = density.into();
|
let light_config = Theme::light_config().ok();
|
||||||
|
let dark_config = Theme::dark_config().ok();
|
||||||
|
|
||||||
if self
|
// Update both light and dark theme configs
|
||||||
.theme_builder
|
if let Some(config) = light_config {
|
||||||
.set_spacing(config, spacing)
|
_ = config.set("spacing", spacing);
|
||||||
.unwrap_or_default()
|
}
|
||||||
{
|
if let Some(config) = dark_config {
|
||||||
self.theme_config_write("spacing", spacing);
|
_ = config.set("spacing", spacing);
|
||||||
}
|
}
|
||||||
|
|
||||||
tokio::task::spawn(async move {
|
tokio::task::spawn(async move {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue