Start styling
- Basic coloring and layouts
This commit is contained in:
parent
3540f8d75a
commit
280651a64d
@ -1,4 +1,5 @@
|
||||
use iced::{
|
||||
application::Appearance, Color,
|
||||
Alignment, Font, Length, Point, Settings, Size, Task,
|
||||
alignment::{Horizontal, Vertical},
|
||||
font::Family,
|
||||
@ -27,7 +28,6 @@ impl WeatherPopup {
|
||||
|
||||
fn view(&self) -> iced::Element<Message> {
|
||||
// Data
|
||||
let default_font = "IosevkaTermSlab Nerd Font Mono";
|
||||
let city = self.resp.name.clone().unwrap_or_else(|| "Unknown".into());
|
||||
let country = self
|
||||
.resp
|
||||
@ -51,6 +51,7 @@ impl WeatherPopup {
|
||||
};
|
||||
|
||||
// UI
|
||||
let default_font = "IosevkaTermSlab Nerd Font Mono";
|
||||
column![
|
||||
// City and country
|
||||
Row::with_children(vec![
|
||||
@ -60,6 +61,7 @@ impl WeatherPopup {
|
||||
..Font::DEFAULT
|
||||
})
|
||||
.size(16)
|
||||
.color(Color::from_rgb(1.0, 1.0, 1.0))
|
||||
.into(),
|
||||
])
|
||||
.width(Length::Fill),
|
||||
@ -72,6 +74,7 @@ impl WeatherPopup {
|
||||
})
|
||||
.align_x(Horizontal::Left)
|
||||
.size(40)
|
||||
.color(Color::from_rgb(1.0, 1.0, 1.0))
|
||||
.into(),
|
||||
Space::with_width(Length::Fill).into(),
|
||||
Text::new(format!("{temperature}°{unit}"))
|
||||
@ -80,6 +83,7 @@ impl WeatherPopup {
|
||||
..Font::DEFAULT
|
||||
})
|
||||
.size(32)
|
||||
.color(Color::from_rgb(1.0, 1.0, 1.0))
|
||||
.into(),
|
||||
])
|
||||
.width(Length::Fill),
|
||||
@ -91,6 +95,7 @@ impl WeatherPopup {
|
||||
..Font::DEFAULT
|
||||
})
|
||||
.size(16)
|
||||
.color(Color::from_rgb(1.0, 1.0, 1.0))
|
||||
.into(),
|
||||
])
|
||||
.width(Length::Fill),
|
||||
@ -117,6 +122,13 @@ pub fn show_popup(resp: WeatherResponse, conf: owm_widg_config::config::Config)
|
||||
decorations: false,
|
||||
..window::Settings::default()
|
||||
})
|
||||
.style(|_state, _theme| {
|
||||
Appearance {
|
||||
background_color: Color::from_rgba(0.1, 0.1, 0.1, 0.25),
|
||||
text_color: Color::default(),
|
||||
}
|
||||
}
|
||||
)
|
||||
.run_with(move || (WeatherPopup::new(resp, conf), Task::none()))
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user