const Y: &[f32] = &[ 7., 0. ];
struct Show {
- text: &'static str,
- background: &'static str,
- sigil: &'static str,
+ text_override: Option<&'static str>,
+ background: &'static str,
+ sigil: &'static str,
}
impl URenderState {
fn show(self) -> Show {
use URS::*;
- let (text, background, sigil) = match self {
- Running => ("black", "yellow", "▶" /* > */ ),
- ActiveHeld => ("black", "yellow", "‖" /* || */ ),
- OtherFlag => ("black", "yellow", ":" ),
- Inactive => ("black", "white", ":" ),
- Stopped => ("black", "lightblue", "□" /* [] */ ),
- Reset => ("black", "lightgreen", "○" /* O */ ),
- Flag => ("white", "red", "⚑" /* F */ ),
+ let (text_override, background, sigil) = match self {
+ Running => (None, "yellow", "▶" /* > */ ),
+ ActiveHeld => (None, "yellow", "‖" /* || */ ),
+ OtherFlag => (None, "yellow", ":" ),
+ Inactive => (None, "white", ":" ),
+ Stopped => (None, "lightblue", "□" /* [] */ ),
+ Reset => (None, "lightgreen", "○" /* O */ ),
+ Flag => (Some("white"), "red", "⚑" /* F */ ),
};
- Show { text, background, sigil }
+ Show { text_override, background, sigil }
+ }
+ }
+ impl Show {
+ fn text(&self) -> &'static str {
+ self.text_override.unwrap_or("black")
}
}
"##);
hwrite!(f, r##"
<text x="1" y="{}" {} {} fill="{}" >{}{}{}</text>"##,
- y, font, pointer, Html::lit(show.text),
+ y, font, pointer, Html::lit(show.text()),
mins_pad, HtmlStr::from_html_str(&mins), Html::lit(show.sigil)
)?;
hwrite!(f, r##"
<text x="14" y="{}" {} {} fill="{}" >{:02}</text>"##,
- y, font, pointer, Html::lit(show.text),
+ y, font, pointer, Html::lit(show.text()),
secs
)?;
let nick_y = y - 0.5;