Skip to content

Commit

Permalink
Add font configuration settings
Browse files Browse the repository at this point in the history
  • Loading branch information
pinpox committed May 27, 2024
1 parent 008c3de commit 586116b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
4 changes: 3 additions & 1 deletion client/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,10 @@ impl Centerpiece {
fn settings(flags: crate::cli::CliArgs) -> iced::Settings<crate::cli::CliArgs> {
let default_text_size = REM;

let settings = crate::settings::Settings::new();

let default_font = iced::Font {
family: iced::font::Family::Name("FiraCode Nerd Font"),
family: iced::font::Family::Name(&settings.font.default),
weight: iced::font::Weight::Normal,
stretch: iced::font::Stretch::Normal,
monospaced: true,
Expand Down
15 changes: 15 additions & 0 deletions client/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,26 @@ pub struct GitRepositoriesPluginSettings {
pub commands: Vec<Vec<String>>,
}

#[derive(Debug, Deserialize)]
pub struct FontSettings {
pub default: String,
}

#[derive(Debug, Deserialize)]
pub struct ColorSettings {
pub text: String,
pub background: String,
pub surface: String,
}

impl Default for FontSettings {
fn default() -> Self {
Self {
default: "FiraCode Nerd Font".to_string(),
}
}
}

impl Default for ColorSettings {
fn default() -> Self {
Self {
Expand Down Expand Up @@ -250,6 +263,8 @@ pub struct Settings {
pub plugin: PluginSettings,
#[serde(default)]
pub color: ColorSettings,
#[serde(default)]
pub font: FontSettings,
}

impl Settings {
Expand Down

0 comments on commit 586116b

Please sign in to comment.