Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
feature(seed_styles): added support for CssColor and theme color for …
…CssTextDecorationColor
  • Loading branch information
arn-the-long-beard committed Jun 17, 2021
commit 029115ea742513f11878fdc0fb001ef0b516c151
16 changes: 15 additions & 1 deletion seed_styles/src/style/css_values.rs
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,21 @@ pub enum CssTextDecoration {
StringValue(String),
}

#[derive(Display, Clone, Debug, CssStyleMacro)]
#[display(fmt = "text-decoration-color: {};")]
pub enum CssTextDecorationColor {
#[display(fmt = "rgba({},{},{},{})", _0, _1, _2, _3)]
Rgba(f64, f64, f64, f64),
#[display(fmt = "hsl({},{}%,{}%)", _0, _1, _2)]
Hsl(f64, f64, f64),
#[display(fmt = "hsla({},{}%,{}%,{})", _0, _1, _2, _3)]
Hsla(f64, f64, f64, f64), #[display(fmt = "#{:06x}", _0)]
Hex(i32),
StringValue(String),
#[display(fmt = "inherit")]
Inherit,
}

#[derive(Display, Clone, Debug, CssStyleMacro)]
#[display(fmt = "text-indent: {};")]
pub enum CssTextIndent {
Expand Down Expand Up @@ -2568,7 +2583,6 @@ create_enums!([
"TabSize",
"TextAlignLast",
"TextCombineUpright",
"TextDecorationColor",
"TextDecorationLine",
"TextDecorationStyle",
"TextEmphasis",
Expand Down
19 changes: 19 additions & 0 deletions seed_styles/src/style/theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,19 @@ impl From<CssColor> for CssBackgroundColor {
}
}

impl From<CssColor> for CssTextDecorationColor {
fn from(val: CssColor) -> Self {
match val {
CssColor::Rgba(r, g, b, a) => Self::Rgba(r, g, b, a),
CssColor::Hsl(h, s, l) => Self::Hsl(h, s, l),
CssColor::Hsla(h, s, l, a) => Self::Hsla(h, s, l, a),
CssColor::Hex(h) => Self::Hex(h),
CssColor::StringValue(val) => Self::StringValue(val),
CssColor::Inherit => Self::Inherit,
}
}
}

impl From<CssColor> for CssFill {
fn from(val: CssColor) -> Self {
match val {
Expand Down Expand Up @@ -1228,6 +1241,12 @@ generate_froms!([
"CssBackgroundColor",
"colors_scale"
),
(
"ColorTheme",
"CssColor",
"CssTextDecorationColor",
"colors_scale"
),
("ColorTheme", "CssColor", "CssBorderColor", "colors_scale"),
(
"ColorTheme",
Expand Down