Add _with_flags() variants to settings helpers (#85)

This commit is contained in:
Ian Douglas Scott 2023-02-20 14:26:31 -08:00 committed by GitHub
parent 8232e1d249
commit 2dde95ee42
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 12 deletions

View file

@ -20,12 +20,18 @@ pub fn set_default_icon_theme(name: impl Into<String>) {
/// Default iced settings for COSMIC applications.
#[must_use]
pub fn settings<Flags: Default>() -> iced::Settings<Flags> {
settings_with_flags(Flags::default())
}
/// Default iced settings for COSMIC applications.
#[must_use]
pub fn settings_with_flags<Flags>(flags: Flags) -> iced::Settings<Flags> {
iced::Settings {
default_font: match font::FONT {
iced::Font::Default => None,
iced::Font::External { bytes, .. } => Some(bytes),
},
default_text_size: 18,
..iced::Settings::default()
..iced::Settings::with_flags(flags)
}
}