Skip to content
Snippets Groups Projects

mix colors for hybrid recoding strategies

Merged STEVAN Antoine requested to merge colors into main
1 file
+ 2
2
Compare changes
  • Side-by-side
  • Inline
+ 2
2
@@ -84,13 +84,13 @@ def try-string-to-int []: string -> int {
export def "color from-string" [s: string]: nothing -> record<r: float, g: float, b: float> {
let res = $s
| parse --regex '^0x(?<r>..)(?<g>..)(?<b>..)$'
| parse --regex '^#(?<r>..)(?<g>..)(?<b>..)$'
| into record
if $res == {} {
error throw {
err: "invalid HEX color format",
label: $"format should be '0xRRGGBB', found ($s)",
label: $"format should be '#RRGGBB', found ($s)",
span: (metadata $s).span,
}
}
Loading