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