Skip to content

Commit

Permalink
Merge pull request #52 from InioX/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
InioX authored Feb 3, 2024
2 parents 3ce21d8 + 2c1b82e commit 34644c3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 37 deletions.
29 changes: 2 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,31 +58,6 @@ Matugen is a cross-platform tool that generates a colorscheme either from an ima
- MacOS
- NetBSD

<h2>
<sub>
<img src="https://github.com/InioX/matugen/assets/81521595/1ff9c777-94d9-4e24-85ec-725a6aa10612"
height="25"
width="25">
</sub>
Roadmap
</h2>

- [ ] Add GTK4 UI
- [x] Add a light/dark/amoled option for each template
- [x] Support more color formats for generating colorscheme
- [x] Rgba
- [x] Rgb
- [x] Hsl
- [x] Suport changing the wallpaper on different platforms
- [x] MacOS
- [x] Windows
- [x] Support changing the wallpaper on X11
- [x] Feh
- [x] Nitrogen

> [!NOTE]
> Want a feature that is not listed above? Simply [open an issue](https://github.com/InioX/Matugen/issues).
<h2>
<sub>
<img src="https://github.com/InioX/matugen/assets/81521595/223f698f-9e72-430b-9a75-c9892fcea94e"
Expand Down Expand Up @@ -200,5 +175,5 @@ make install
Acknowledgements
</h2>

- [material-color-utilities-rs](https://github.com/alphaqu/material-color-utilities-rs)
- [wallpaper.rs](https://github.com/reujab/wallpaper.rs)
- [material-colors](https://github.com/Aiving/material-colors)
- [wallpaper.rs](https://github.com/reujab/wallpaper.rs) - Changing wallpaper for Windows
21 changes: 11 additions & 10 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ fn main() -> Result<(), Report> {

let source_color = get_source_color(&args.source)?;

let scheme_dark = generate_scheme(&args.r#type, source_color, true);
let scheme_light = generate_scheme(&args.r#type, source_color, false);
let scheme_dark = generate_scheme(&args.r#type, source_color, true, args.contrast);
let scheme_light = generate_scheme(&args.r#type, source_color, false, args.contrast);

let config: ConfigFile = ConfigFile::read(&args)?;

Expand Down Expand Up @@ -166,37 +166,38 @@ fn generate_scheme(
scheme_type: &Option<SchemeTypes>,
source_color: [u8; 4],
is_dark: bool,
contrast_level: Option<f64>,
) -> Scheme {
match scheme_type.unwrap() {
SchemeTypes::SchemeContent => {
return Scheme::from(SchemeContent::new(Hct::new(source_color), is_dark, None).scheme)
return Scheme::from(SchemeContent::new(Hct::new(source_color), is_dark, contrast_level).scheme)
}
SchemeTypes::SchemeExpressive => {
return Scheme::from(
SchemeExpressive::new(Hct::new(source_color), is_dark, None).scheme,
SchemeExpressive::new(Hct::new(source_color), is_dark, contrast_level).scheme,
)
}
SchemeTypes::SchemeFidelity => {
return Scheme::from(SchemeFidelity::new(Hct::new(source_color), is_dark, None).scheme)
return Scheme::from(SchemeFidelity::new(Hct::new(source_color), is_dark, contrast_level).scheme)
}
SchemeTypes::SchemeFruitSalad => {
return Scheme::from(
SchemeFruitSalad::new(Hct::new(source_color), is_dark, None).scheme,
SchemeFruitSalad::new(Hct::new(source_color), is_dark, contrast_level).scheme,
)
}
SchemeTypes::SchemeMonochrome => {
return Scheme::from(
SchemeMonochrome::new(Hct::new(source_color), is_dark, None).scheme,
SchemeMonochrome::new(Hct::new(source_color), is_dark, contrast_level).scheme,
)
}
SchemeTypes::SchemeNeutral => {
return Scheme::from(SchemeNeutral::new(Hct::new(source_color), is_dark, None).scheme)
return Scheme::from(SchemeNeutral::new(Hct::new(source_color), is_dark, contrast_level).scheme)
}
SchemeTypes::SchemeRainbow => {
return Scheme::from(SchemeRainbow::new(Hct::new(source_color), is_dark, None).scheme)
return Scheme::from(SchemeRainbow::new(Hct::new(source_color), is_dark, contrast_level).scheme)
}
SchemeTypes::SchemeTonalSpot => {
return Scheme::from(SchemeTonalSpot::new(Hct::new(source_color), is_dark, None).scheme)
return Scheme::from(SchemeTonalSpot::new(Hct::new(source_color), is_dark, contrast_level).scheme)
}
}
}
5 changes: 5 additions & 0 deletions src/util/arguments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ pub struct Cli {
#[arg(short, long, value_name = "FILE", global = true)]
pub config: Option<PathBuf>,

/// Value from -1 to 1. -1 represents minimum contrast, 0 represents
/// standard (i.e. the design as spec'd), and 1 represents maximum contrast.
#[arg(long, global = true, allow_negative_numbers = true)]
pub contrast: Option<f64>,

#[arg(short, long, global = true, action=ArgAction::SetTrue)]
pub verbose: Option<bool>,

Expand Down

0 comments on commit 34644c3

Please sign in to comment.