From b300a6304aecc5e3f30d121d2c0c6085a1004ae5 Mon Sep 17 00:00:00 2001 From: InioX Date: Tue, 26 Mar 2024 18:00:00 +0100 Subject: [PATCH] fix: format `harmonized_colors` in `dump_json` (#53) --- src/util/color.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/util/color.rs b/src/util/color.rs index a48e388..0cd1e68 100644 --- a/src/util/color.rs +++ b/src/util/color.rs @@ -152,6 +152,18 @@ pub fn dump_json( colors_normal_light.insert(field, fmt(color_light)); colors_normal_dark.insert(field, fmt(color_dark)); } + + let mut harmonized_colors_map: HashMap<&str, String> = HashMap::new(); + + match harmonized_colors { + Some(harmonized_colors) => { + for (name, color) in harmonized_colors { +let color: Rgb = rgb_from_argb(*color); +harmonized_colors_map.insert(name.as_str(), fmt(color)); + } + } + None => {} + } colors_normal_light.insert("source_color", fmt(rgb_from_argb(*source_color))); @@ -162,7 +174,7 @@ pub fn dump_json( "light": colors_normal_light, "dark": colors_normal_dark, }, - "harmonized_colors": harmonized_colors, + "harmonized_colors": harmonized_colors_map, }) ); }