Skip to content

Commit

Permalink
fix: format harmonized_colors in dump_json (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
InioX committed Mar 26, 2024
1 parent e278b4f commit b300a63
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/util/color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)));

Expand All @@ -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,
})
);
}
Expand Down

0 comments on commit b300a63

Please sign in to comment.