Skip to content

Commit

Permalink
feat: add new formats for keywords
Browse files Browse the repository at this point in the history
  • Loading branch information
InioX committed Dec 11, 2023
1 parent fe9d5b7 commit ddb38cc
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions src/util/template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ struct Colora {
rgba: String,
hsl: String,
hsla: String,
red: String,
green: String,
blue: String,
alpha: String,
hue: String,
saturation: String,
lightness: String,
}

#[derive(Serialize, Deserialize, Debug)]
Expand Down Expand Up @@ -391,5 +398,48 @@ fn generate_color_strings(color: Color) -> Colora {
None,
)
.to_css_string(),
red: format!(
"{:?}",
color.blue
),
green: format!(
"{:?}",
color.green
),
blue: format!(
"{:?}",
color.blue
),
alpha: format!(
"{:?}",
color.alpha
),
hue: format!(
"{:?}",
Hsl::new(
color.red as f64,
color.green as f64,
color.blue as f64,
Some(color.alpha as f64),
).hue()
),
lightness: format!(
"{:?}",
Hsl::new(
color.red as f64,
color.green as f64,
color.blue as f64,
Some(color.alpha as f64),
).lightness()
),
saturation: format!(
"{:?}",
Hsl::new(
color.red as f64,
color.green as f64,
color.blue as f64,
Some(color.alpha as f64),
).saturation()
),
}
}

0 comments on commit ddb38cc

Please sign in to comment.