diff --git a/Cargo.lock b/Cargo.lock index 90cc085..cd90ea9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -853,13 +853,12 @@ checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "material-colors" -version = "0.1.4" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26c4282c2e70d1c54dc89fed1b45f890200693daa89b72b805e2439878144bc" +checksum = "ad4586e7fe5c38f2a0522c58977b9f07b4f47e3d5f6acb778e816e02c7397be5" dependencies = [ "ahash", "indexmap", - "rand", ] [[package]] @@ -873,6 +872,7 @@ dependencies = [ "directories", "enquote", "image", + "indexmap", "log", "material-colors", "owo-colors 4.0.0", @@ -1042,12 +1042,6 @@ dependencies = [ "miniz_oxide", ] -[[package]] -name = "ppv-lite86" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" - [[package]] name = "pretty_env_logger" version = "0.5.0" @@ -1099,36 +1093,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha", - "rand_core", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom", -] - [[package]] name = "rayon" version = "1.8.0" diff --git a/Cargo.toml b/Cargo.toml index e85faf5..e191624 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" diff --git a/src/main.rs b/src/main.rs index 0acfe02..bc6d68d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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}; @@ -31,8 +32,8 @@ use material_colors::{ }; pub struct Schemes { - pub light: HashMap, - pub dark: HashMap, + pub light: IndexMap, + pub dark: IndexMap, } #[derive(Serialize, Deserialize, Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum)] @@ -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) { diff --git a/src/util/color.rs b/src/util/color.rs index 8e8cecc..3eab237 100644 --- a/src/util/color.rs +++ b/src/util/color.rs @@ -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 { @@ -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(); }