cosmic/widget/wayland/tooltip/
mod.rs1pub mod widget;
4
5use iced_core::{Background, Color, Vector, border::Radius};
9
10use crate::theme::THEME;
11
12#[must_use]
14#[derive(Debug, Clone, Copy)]
15pub struct Style {
16 pub shadow_offset: Vector,
18
19 pub background: Option<Background>,
21
22 pub border_radius: Radius,
24
25 pub border_width: f32,
27
28 pub border_color: Color,
30
31 pub outline_width: f32,
33
34 pub outline_color: Color,
36
37 pub icon_color: Option<Color>,
39
40 pub text_color: Color,
42}
43
44impl Style {
45 pub fn new() -> Self {
47 let rad_0 = THEME.lock().unwrap().cosmic().corner_radii.radius_0;
48 Self {
49 shadow_offset: Vector::new(0.0, 0.0),
50 background: None,
51 border_radius: Radius::from(rad_0),
52 border_width: 0.0,
53 border_color: Color::TRANSPARENT,
54 outline_width: 0.0,
55 outline_color: Color::TRANSPARENT,
56 icon_color: None,
57 text_color: Color::BLACK,
58 }
59 }
60}
61
62impl std::default::Default for Style {
63 fn default() -> Self {
64 Self::new()
65 }
66}
67
68pub trait Catalog {
71 type Class: Default;
73
74 fn style(&self, style: &Self::Class) -> Style;
76}