Skip to content

Commit

Permalink
Merge pull request #51 from InioX/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
InioX authored Feb 2, 2024
2 parents ab38e92 + 7d244e8 commit 3ce21d8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 45 deletions.
42 changes: 3 additions & 39 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ upon = "0.8.0"
reqwest = { version = "0.11.23", default_features=false, features = ["blocking", "rustls-tls"] }
material-colors = "0.1.4"
ahash = "0.8.7"
indexmap = "2.2.2"
11 changes: 6 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ use crate::util::{
template::Template,
};

use indexmap::IndexMap;

use material_colors::{Hct, Scheme};
use std::collections::HashMap;

use clap::{Parser, ValueEnum};
use color_eyre::{eyre::Result, Report};
Expand All @@ -31,8 +32,8 @@ use material_colors::{
};

pub struct Schemes {
pub light: HashMap<String, [u8; 4], ahash::random_state::RandomState>,
pub dark: HashMap<String, [u8; 4], ahash::random_state::RandomState>,
pub light: IndexMap<String, [u8; 4], ahash::random_state::RandomState>,
pub dark: IndexMap<String, [u8; 4], ahash::random_state::RandomState>,
}

#[derive(Serialize, Deserialize, Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum)]
Expand Down Expand Up @@ -71,8 +72,8 @@ fn main() -> Result<(), Report> {
.expect("Something went wrong while parsing the mode");

let schemes: Schemes = Schemes {
dark: HashMap::from(scheme_dark),
light: HashMap::from(scheme_light),
dark: IndexMap::from_iter(scheme_dark),
light: IndexMap::from_iter(scheme_light),
};

if args.show_colors == Some(true) {
Expand Down
4 changes: 3 additions & 1 deletion src/util/color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub fn rgb_from_argb(color: [u8; 4]) -> Rgb {
])
}

pub fn show_color(schemes: &Schemes, _source_color: &[u8; 4]) {
pub fn show_color(schemes: &Schemes, source_color: &[u8; 4]) {
let mut table: Table = generate_table_format();

for (field, _color) in &schemes.dark {
Expand All @@ -36,6 +36,8 @@ pub fn show_color(schemes: &Schemes, _source_color: &[u8; 4]) {
generate_table_rows(&mut table, field, color_light, color_dark);
}

generate_table_rows(&mut table, "source_color", rgb_from_argb(*source_color), rgb_from_argb(*source_color));

table.printstd();
}

Expand Down

0 comments on commit 3ce21d8

Please sign in to comment.