Skip to content

Commit

Permalink
Rework themes. Add theme setting. Remove complex themes. Remove sampl…
Browse files Browse the repository at this point in the history
…e generation commands. Use toml for theme config
  • Loading branch information
Exidex committed Jan 6, 2025
1 parent f9e4f66 commit f0a18f0
Show file tree
Hide file tree
Showing 37 changed files with 1,319 additions and 727 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ edition = "2021"
[workspace.dependencies]
# iced
#iced = { version = "0.13.99", features = ["tokio", "lazy", "advanced", "image"] }
iced = { git = "https://github.com/project-gauntlet/iced.git", branch = "gauntlet-0.13", features = ["tokio", "lazy", "advanced", "image"] }
iced = { git = "https://github.com/project-gauntlet/iced.git", branch = "gauntlet-0.13", default-features = false, features = ["webgl", "tokio", "lazy", "advanced", "image"] }
#iced_aw = { version = "0.11.99", features = ["date_picker", "wrap", "number_input", "grid", "spinner"] }
iced_aw = { git = "https://github.com/project-gauntlet/iced_aw.git", branch = "gauntlet-0.13", default-features = false, features = ["date_picker", "wrap", "number_input", "grid", "spinner"] }
#iced_table = "0.13.99"
Expand Down Expand Up @@ -66,6 +66,7 @@ bytes = { version = "1.6.0" }
walkdir = { version = "2.4.0" }
typed-path = { version = "0.10.0" }
interprocess = { version = "2.2.2", features = ["tokio"] }
toml = "0.8"

[dependencies]
gauntlet-cli = { path = "rust/cli" }
Expand Down
23 changes: 23 additions & 0 deletions bundled_themes/legacy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
mode = "dark"

background = [
{ color = "#626974", alpha = 0.3 },
{ color = "#48505B", alpha = 0.5 },
"#333A42",
"#2C323A"
]

text = [
"#DDDFE1",
"#9AA0A6",
"#6B7785",
"#1D242C"
]

[window.border]
radius = 10
width = 1
color = { color = "#48505B", alpha = 0.5 }

[content.border]
radius = 4.0
23 changes: 23 additions & 0 deletions bundled_themes/macos_dark.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
mode = "dark"

background = [
{ color = "#646464", alpha = 0.5 },
"#373737",
"#2D2D2D",
"#242424",
]

text = [
"#E5E5E5",
"#C8C8C8",
"#969696",
"#323232"
]

[window.border]
radius = 8
width = 1
color = { color = "#646464", alpha = 0.5 }

[content.border]
radius = 4.0
23 changes: 23 additions & 0 deletions bundled_themes/macos_light.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
mode = "light"

background = [
{ color = "#000000", alpha = 0.2 },
"#C8C8C8",
"#D2D2D2",
"#EAEAEA",
]

text = [
{ color = "#000000", alpha = 1.0 },
{ color = "#000000", alpha = 0.847 },
{ color = "#000000", alpha = 0.498 },
{ color = "#000000", alpha = 0.259 },
]

[window.border]
radius = 8
width = 1
color = "#B9B9B9"

[content.border]
radius = 4.0
6 changes: 1 addition & 5 deletions rust/cli/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use anyhow::{anyhow, Context};
use clap::Parser;
use gauntlet_client::{generate_complex_theme_sample, generate_simple_theme_sample, open_window};
use gauntlet_client::open_window;
use gauntlet_management_client::start_management_client;
use gauntlet_server::start;

Expand All @@ -17,8 +17,6 @@ struct Cli {
enum Commands {
Open,
Settings,
GenerateSampleComplexTheme,
GenerateSampleSimpleTheme,
}

pub fn init() {
Expand Down Expand Up @@ -47,8 +45,6 @@ pub fn init() {
match command {
Commands::Open => open_window(),
Commands::Settings => start_management_client(),
Commands::GenerateSampleComplexTheme => generate_complex_theme_sample().expect("Unable to generate complex theme sample"),
Commands::GenerateSampleSimpleTheme => generate_simple_theme_sample().expect("Unable to generate simple theme sample")
};
}
}
Expand Down
1 change: 1 addition & 0 deletions rust/client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ once_cell.workspace = true

# other
global-hotkey = "0.6.3"
arc-swap = "1.7.1"

[target.'cfg(any(target_os = "macos", target_os = "windows"))'.dependencies]
tray-icon = { version = "0.19.2", default-features = false }
Expand Down
47 changes: 0 additions & 47 deletions rust/client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,50 +60,3 @@ pub fn open_settings_window() {
})
}

pub fn generate_complex_theme_sample() -> anyhow::Result<()> {
let dirs = Dirs::new();

let sample_complex_theme_file = dirs.sample_complex_theme_file();
let complex_theme_file = dirs.complex_theme_file();

let theme_complex = GauntletComplexTheme::default_theme(GauntletComplexTheme::default_simple_theme());

let string = serde_json::to_string_pretty(&theme_complex)?;

let sample_theme_parent = sample_complex_theme_file
.parent()
.expect("no parent?");

std::fs::create_dir_all(sample_theme_parent)?;

std::fs::write(&sample_complex_theme_file, string)?;

println!("Created sample using default complex theme at {:?}", sample_complex_theme_file);
println!("Make changes and rename file to {:?}", complex_theme_file.file_name().unwrap());

Ok(())
}

pub fn generate_simple_theme_sample() -> anyhow::Result<()> {
let dirs = Dirs::new();

let sample_simple_theme_file = dirs.sample_simple_theme_color_file();
let simple_theme_file = dirs.theme_simple_file();

let theme = GauntletComplexTheme::default_simple_theme();

let string = serde_json::to_string_pretty(&theme)?;

let sample_theme_parent = sample_simple_theme_file
.parent()
.expect("no parent?");

std::fs::create_dir_all(sample_theme_parent)?;

std::fs::write(&sample_simple_theme_file, string)?;

println!("Created sample using default simple theme at {:?}", sample_simple_theme_file);
println!("Make changes and rename file to {:?}", simple_theme_file.file_name().unwrap());

Ok(())
}
Loading

0 comments on commit f0a18f0

Please sign in to comment.