Skip to content

Commit

Permalink
feat(whiskers): add colors object in context (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
nekowinston authored Dec 14, 2023
1 parent 4edcce0 commit 0f08acc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion whiskers/src/template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,13 @@ pub fn make_context(flavor: catppuccin::Flavour) -> serde_json::Value {
.collect();

let mut context =
serde_json::to_value(color_map).expect("color names & hexcodes can be serialized");
serde_json::to_value(color_map.clone()).expect("color names & hexcodes can be serialized");

context["flavor"] = flavor.name().into();
context["isLight"] = (flavor == catppuccin::Flavour::Latte).into();
context["isDark"] = (flavor != catppuccin::Flavour::Latte).into();
context["colors"] =
serde_json::to_value(color_map).expect("color names & hexcodes can be serialized");

context
}

0 comments on commit 0f08acc

Please sign in to comment.