refactor: replace regex with jq filters
This commit is contained in:
parent
8a32c1b089
commit
fa18ce9559
1 changed files with 4 additions and 2 deletions
|
@ -2,7 +2,9 @@ map_values(map_values({
|
|||
hex: .hex | ltrimstr("#"),
|
||||
rgb: .raw | split(", ") | map(tonumber),
|
||||
hsl: .hsl
|
||||
| capture("hsl\\((?<h>\\d+),\\s*(?<s>\\d+)%,\\s*(?<l>\\d+)%\\)")
|
||||
| map(tonumber)
|
||||
| ltrimstr("hsl(")
|
||||
| rtrimstr(")")
|
||||
| split(", ")
|
||||
| map(rtrimstr("%") | tonumber)
|
||||
| [ .[0], .[1] / 100, .[2] / 100 ]
|
||||
}))
|
||||
|
|
Loading…
Reference in a new issue