Skip to content

Commit

Permalink
Added alpha property to set command
Browse files Browse the repository at this point in the history
  • Loading branch information
kanielrkirby authored and sharkdp committed Jun 22, 2024
1 parent ab47bdb commit fc28c4a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/cli/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,8 @@ pub fn build_cli() -> Command<'static> {
"lab-a", "lab-b",
"oklab-l", "oklab-a", "oklab-b",
"red", "green", "blue",
"hsl-hue", "hsl-saturation", "hsl-lightness"])
"hsl-hue", "hsl-saturation", "hsl-lightness",
"alpha"])
.ignore_case(true)
.required(true),
)
Expand Down
5 changes: 5 additions & 0 deletions src/cli/commands/color_commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,11 @@ color_command!(SetCommand, config, matches, color, {
}
Color::from_lch(lch.l, lch.c, lch.h, lch.alpha)
}
"alpha" => {
let mut hsla = color.to_hsla();
hsla.alpha = value;
Color::from_hsla(hsla.h, hsla.s, hsla.l, hsla.alpha)
}
&_ => {
unreachable!("Unknown property");
}
Expand Down

0 comments on commit fc28c4a

Please sign in to comment.