omg colors

Signed-off-by: Christine Dodrill <me@christine.website>
This commit is contained in:
Cadey Ratio 2021-01-30 10:34:31 -05:00
parent 8501c8b61d
commit 398cd96934
2 changed files with 13 additions and 1 deletions

View File

@ -39,6 +39,15 @@ fn main() -> Result<()> {
let data = mtst.lock().unwrap();
let mut blocks: Vec<Block> = vec![Block {
full_text: data.front.clone(),
color: match data.front.as_str() {
"Cadey" => Some("#F86AF3".to_string()),
"Nicole" => Some("#C79DD7".to_string()),
"Jessie" => Some("#97871A".to_string()),
"Ashe" => Some("#458588".to_string()),
"Sephie" => Some("#D79921".to_string()),
"Mai" => Some("#D65D0E".to_string()),
_ => None,
},
}];
if let Some(datni) = &data.weather {
@ -50,11 +59,13 @@ fn main() -> Result<()> {
datni.daily.data[0].temperature_high,
datni.daily.data[0].temperature_low
),
color: None,
})
}
blocks.push(Block {
full_text: Local::now().format("%H:%M M%m %-d %a").to_string(),
color: None,
});
println!(",{}", serde_json::to_string(&blocks)?);

View File

@ -29,9 +29,10 @@ pub struct State {
pub weather: Option<weather::Root>,
}
#[derive(Serialize)]
#[derive(Serialize, Default)]
pub struct Block {
pub full_text: String,
pub color: Option<String>,
}
impl fmt::Display for State {