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

View File

@ -80,6 +80,7 @@ fn hour_name_path(image_width: u32, outer_r: f32, ring_width: f32) -> Path {
fn hour_marker( fn hour_marker(
hour: i32, hour: i32,
is_current_hour: bool,
image_width: u32, image_width: u32,
outer_r: f32, outer_r: f32,
ring_width: f32, ring_width: f32,
@ -147,7 +148,13 @@ fn hour_marker(
.add(TextNode::new(format!("U {:02}", hour))); .add(TextNode::new(format!("U {:02}", hour)));
Group::new() Group::new()
.set("class", format!("hour {season}")) .set(
"class",
format!(
"hour {season}{}",
if is_current_hour { " active" } else { "" }
),
)
.set( .set(
"transform", "transform",
format!( format!(
@ -313,9 +320,13 @@ fn gen_svg() -> Document {
.hour text {stroke: none; fill: rgb(238, 187, 85);} .hour text {stroke: none; fill: rgb(238, 187, 85);}
.hour text.utc {stroke: none; fill: rgb(91, 68, 38);} .hour text.utc {stroke: none; fill: rgb(91, 68, 38);}
.winter path {fill: rgb(70, 62, 108);} .winter path {fill: rgb(70, 62, 108);}
.active.winter path {fill: rgb(100, 92, 138);}
.spring path {fill: rgb(55, 87, 55);} .spring path {fill: rgb(55, 87, 55);}
.active.spring path {fill: rgb(85, 117, 85);}
.summer path {fill: rgb(113, 92, 43);} .summer path {fill: rgb(113, 92, 43);}
.active.summer path {fill: rgb(143, 122, 73);}
.autumn path {fill: rgb(108, 68, 44);} .autumn path {fill: rgb(108, 68, 44);}
.active.autumn path {fill: rgb(138, 98, 74);}
.local-hour {stroke: none; fill: rgb(238, 187, 85);} .local-hour {stroke: none; fill: rgb(238, 187, 85);}
.night-time {stroke: none; fill: rgb(19, 17, 30);} .night-time {stroke: none; fill: rgb(19, 17, 30);}
.blue-hour {stroke: none; fill: rgb(9, 1, 119);} .blue-hour {stroke: none; fill: rgb(9, 1, 119);}
@ -369,6 +380,7 @@ fn gen_svg() -> Document {
for hour in 0i32..24 { for hour in 0i32..24 {
seasonal_clock = seasonal_clock.add(hour_marker( seasonal_clock = seasonal_clock.add(hour_marker(
hour, hour,
hour == utc_hour as i32,
image_width, image_width,
outer_r, outer_r,
ring_width, ring_width,