Highlight the current hour name with a brighter colour

This commit is contained in:
Gergely Polonkai 2022-05-19 05:33:19 +02:00
parent 81907c5842
commit ac95404017
No known key found for this signature in database
GPG Key ID: 2D2885533B869ED4
1 changed files with 13 additions and 1 deletions

View File

@ -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,