omg colors
Signed-off-by: Christine Dodrill <me@christine.website>
This commit is contained in:
parent
8501c8b61d
commit
398cd96934
|
@ -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)?);
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue