nodesnim/core/stylesheet

Types

StyleSheetObj = object
  dict*: seq[tuple[key, value: string]]
StyleSheetRef = ref StyleSheetObj

Procs

proc StyleSheet(arg: seq[tuple[key, value: string]] = @[]): StyleSheetRef {...}{.
    raises: [], tags: [].}
proc StyleSheet(arg: string): StyleSheetRef {...}{.raises: [], tags: [].}
proc StyleSheet(arg: openArray[tuple[key, value: string]]): StyleSheetRef {...}{.
    raises: [], tags: [].}
proc `$`(a: StyleSheetRef): string {...}{.raises: [], tags: [].}
proc `[]`(a: StyleSheetRef; key: string): string {...}{.raises: [], tags: [].}
proc `[]=`(a: StyleSheetRef; key, value: string) {...}{.raises: [], tags: [].}
proc len(a: StyleSheetRef): int {...}{.inline, raises: [], tags: [].}
Returns styles count.

Macros

macro style(obj: untyped): untyped
Translates CSS-like code into StyleSheet.

Example

echo style(
  {
    background-color: rgba(255, 255, 255, 1),
    color: rgb(0, 0, 0)
  }
)