From ac954040170c9c1963852c8e9d17cd8b251bd7b5 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Thu, 19 May 2022 05:33:19 +0200 Subject: [PATCH] Highlight the current hour name with a brighter colour --- src/main.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index f28be2a..e6fac2f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -80,6 +80,7 @@ fn hour_name_path(image_width: u32, outer_r: f32, ring_width: f32) -> Path { fn hour_marker( hour: i32, + is_current_hour: bool, image_width: u32, outer_r: f32, ring_width: f32, @@ -147,7 +148,13 @@ fn hour_marker( .add(TextNode::new(format!("U {:02}", hour))); Group::new() - .set("class", format!("hour {season}")) + .set( + "class", + format!( + "hour {season}{}", + if is_current_hour { " active" } else { "" } + ), + ) .set( "transform", format!( @@ -313,9 +320,13 @@ fn gen_svg() -> Document { .hour text {stroke: none; fill: rgb(238, 187, 85);} .hour text.utc {stroke: none; fill: rgb(91, 68, 38);} .winter path {fill: rgb(70, 62, 108);} + .active.winter path {fill: rgb(100, 92, 138);} .spring path {fill: rgb(55, 87, 55);} + .active.spring path {fill: rgb(85, 117, 85);} .summer path {fill: rgb(113, 92, 43);} + .active.summer path {fill: rgb(143, 122, 73);} .autumn path {fill: rgb(108, 68, 44);} + .active.autumn path {fill: rgb(138, 98, 74);} .local-hour {stroke: none; fill: rgb(238, 187, 85);} .night-time {stroke: none; fill: rgb(19, 17, 30);} .blue-hour {stroke: none; fill: rgb(9, 1, 119);} @@ -369,6 +380,7 @@ fn gen_svg() -> Document { for hour in 0i32..24 { seasonal_clock = seasonal_clock.add(hour_marker( hour, + hour == utc_hour as i32, image_width, outer_r, ring_width,