diff --git a/src/ui/text_svg.rs b/src/ui/text_svg.rs index 74bc260..8634776 100644 --- a/src/ui/text_svg.rs +++ b/src/ui/text_svg.rs @@ -1,17 +1,25 @@ -use cosmic::iced::Font; +use cosmic::iced::Font as IcedFont; -#[derive(Clone, Debug, PartialEq, Eq)] +#[derive(Clone, Debug, Default, PartialEq, Eq)] pub struct TextSvg { text: String, font: Font, shadow: Shadow, - stroke: Color, + stroke: Stroke, + fill: Color, } -#[derive(Clone, Debug, PartialEq, Eq)] -pub struct Color {} +#[derive(Clone, Debug, Default, PartialEq, Eq)] +pub struct Font(IcedFont); -#[derive(Clone, Debug, PartialEq, Eq)] +#[derive(Clone, Debug, Default, PartialEq, Eq)] +pub struct Color { + red: u8, + green: u8, + blue: u8, +} + +#[derive(Clone, Debug, Default, PartialEq, Eq)] pub struct Shadow { offset_x: i16, offset_y: i16, @@ -19,8 +27,36 @@ pub struct Shadow { color: Color, } -#[derive(Clone, Debug, PartialEq, Eq)] +#[derive(Clone, Debug, Default, PartialEq, Eq)] pub struct Stroke { size: u16, color: Color, } + +impl TextSvg { + pub fn new() -> Self { + Self { + ..Default::default() + } + } + + pub fn fill(mut self, color: impl Into) -> Self { + self.fill = color.into(); + self + } + + pub fn shadow(mut self, shadow: impl Into) -> Self { + self.shadow = shadow.into(); + self + } + + pub fn stroke(mut self, stroke: impl Into) -> Self { + self.stroke = stroke.into(); + self + } + + pub fn font(mut self, font: impl Into) -> Self { + self.font = font.into(); + self + } +}