This commit is contained in:
Andreas Rumpf 2017-06-21 18:20:57 +02:00
commit 8dbc1da708
2 changed files with 9 additions and 0 deletions

View file

@ -14,6 +14,7 @@ proc `&`*(a, b: cstring): cstring {.importcpp: "(# + #)", nodecl.}
proc toCstr*(s: int): cstring {.importcpp: "((#)+'')", nodecl.}
proc `&`*(s: int): cstring {.importcpp: "((#)+'')", nodecl.}
proc `&`*(s: bool): cstring {.importcpp: "((#)+'')", nodecl.}
proc `&`*(s: float): cstring {.importcpp: "((#)+'')", nodecl.}
proc `&`*(s: cstring): cstring {.importcpp: "(#)", nodecl.}

View file

@ -255,3 +255,11 @@ proc applyStyle*(n: Node; s: VStyle) =
n.style = Style()
for x in s.mask:
n.style.setStyle(toStyleAttrName[x], s.attrs[x])
import jstrutils
proc rgb*(r, g, b: range[0..255]): cstring =
cstring"rgb(" & &r & cstring", " & &g & cstring", " & &b & cstring")"
proc rgba*(r, g, b: range[0..255], alpha: float): cstring =
cstring"rgb(" & &r & cstring", " & &g & cstring", " & &b & cstring", " & &alpha & cstring")"