diff options
author | bptato <nincsnevem662@gmail.com> | 2022-12-25 16:19:24 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2022-12-25 16:19:24 +0100 |
commit | 412dafe1327d64793a9fb66814211db4a6c4ced2 (patch) | |
tree | 660467c7127721a79e562263b9f03429eea92890 /src/types | |
parent | 65307235bf255b8247397b1d0b62a1e5f65e0bfb (diff) | |
download | chawan-412dafe1327d64793a9fb66814211db4a6c4ced2.tar.gz |
Fix broken css color function parsing
Diffstat (limited to 'src/types')
-rw-r--r-- | src/types/color.nim | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/types/color.nim b/src/types/color.nim index e4668ca9..02f56a56 100644 --- a/src/types/color.nim +++ b/src/types/color.nim @@ -256,9 +256,15 @@ func YUV*(Y, U, V: int): RGBColor = func rgba*(r, g, b, a: int): RGBAColor = return RGBAColor((uint32(a) shl 24) or (uint32(r) shl 16) or (uint32(g) shl 8) or uint32(b)) +template `$`*(rgbcolor: RGBColor): string = + "rgb(" & $rgbcolor.r & ", " & $rgbcolor.g & ", " & $rgbcolor.b & ")" + +template `$`*(rgbacolor: RGBAColor): string = + "rgba(" & $rgbacolor.r & ", " & $rgbacolor.g & ", " & $rgbacolor.b & ", " & $rgbacolor.a & ")" + template `$`*(color: CellColor): string = if color.rgb: - "r" & $color.rgbcolor.r & "g" & $color.rgbcolor.g & "b" & $color.rgbcolor.b + $color.rgbcolor else: "tcolor" & $color.n |