add toCss: allows tdiv(style = "font-style: oblique; color: pink".toCss) (#158)
* add toCss: allows tdiv(style = "font-style: oblique; color: pink".toCss) * fixup to work with nim c
This commit is contained in:
parent
bd18fc980c
commit
04779f8502
2 changed files with 40 additions and 1 deletions
17
examples/hellostyle.nim
Normal file
17
examples/hellostyle.nim
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
include karax / prelude
|
||||
import karax / vstyles
|
||||
|
||||
proc createDom(): VNode =
|
||||
result = buildHtml(tdiv):
|
||||
tdiv(style = style(StyleAttr.color, "red".cstring)):
|
||||
text "red"
|
||||
tdiv(style = style(StyleAttr.color, "blue")):
|
||||
text "blue"
|
||||
# explicit `kstring` required for varargs overload
|
||||
tdiv(style = style((fontStyle, "italic".kstring), (color, "orange".kstring))):
|
||||
text "italic orange"
|
||||
# can use a string directly
|
||||
tdiv(style = "font-style: oblique; color: pink".toCss):
|
||||
text "oblique pink"
|
||||
|
||||
setRenderer createDom
|
||||
Loading…
Add table
Add a link
Reference in a new issue