Skip to content

Commit 62a3ef9

Browse files
arn-the-long-beardMartinKavik
authored andcommitted
feature(seed_styles): added support for CssColor and theme color for CssTextDecorationColor
1 parent a25af69 commit 62a3ef9

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

seed_styles/src/style/css_values.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,21 @@ pub enum CssTextDecoration {
596596
StringValue(String),
597597
}
598598

599+
#[derive(Display, Clone, Debug, CssStyleMacro)]
600+
#[display(fmt = "text-decoration-color: {};")]
601+
pub enum CssTextDecorationColor {
602+
#[display(fmt = "rgba({},{},{},{})", _0, _1, _2, _3)]
603+
Rgba(f64, f64, f64, f64),
604+
#[display(fmt = "hsl({},{}%,{}%)", _0, _1, _2)]
605+
Hsl(f64, f64, f64),
606+
#[display(fmt = "hsla({},{}%,{}%,{})", _0, _1, _2, _3)]
607+
Hsla(f64, f64, f64, f64), #[display(fmt = "#{:06x}", _0)]
608+
Hex(i32),
609+
StringValue(String),
610+
#[display(fmt = "inherit")]
611+
Inherit,
612+
}
613+
599614
#[derive(Display, Clone, Debug, CssStyleMacro)]
600615
#[display(fmt = "text-indent: {};")]
601616
pub enum CssTextIndent {
@@ -2568,7 +2583,6 @@ create_enums!([
25682583
"TabSize",
25692584
"TextAlignLast",
25702585
"TextCombineUpright",
2571-
"TextDecorationColor",
25722586
"TextDecorationLine",
25732587
"TextDecorationStyle",
25742588
"TextEmphasis",

seed_styles/src/style/theme.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,19 @@ impl From<CssColor> for CssBackgroundColor {
617617
}
618618
}
619619

620+
impl From<CssColor> for CssTextDecorationColor {
621+
fn from(val: CssColor) -> Self {
622+
match val {
623+
CssColor::Rgba(r, g, b, a) => Self::Rgba(r, g, b, a),
624+
CssColor::Hsl(h, s, l) => Self::Hsl(h, s, l),
625+
CssColor::Hsla(h, s, l, a) => Self::Hsla(h, s, l, a),
626+
CssColor::Hex(h) => Self::Hex(h),
627+
CssColor::StringValue(val) => Self::StringValue(val),
628+
CssColor::Inherit => Self::Inherit,
629+
}
630+
}
631+
}
632+
620633
impl From<CssColor> for CssFill {
621634
fn from(val: CssColor) -> Self {
622635
match val {
@@ -1228,6 +1241,12 @@ generate_froms!([
12281241
"CssBackgroundColor",
12291242
"colors_scale"
12301243
),
1244+
(
1245+
"ColorTheme",
1246+
"CssColor",
1247+
"CssTextDecorationColor",
1248+
"colors_scale"
1249+
),
12311250
("ColorTheme", "CssColor", "CssBorderColor", "colors_scale"),
12321251
(
12331252
"ColorTheme",

0 commit comments

Comments
 (0)