diff options
author | bptato <nincsnevem662@gmail.com> | 2021-11-09 23:20:13 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2021-11-09 23:20:13 +0100 |
commit | e6f7cc72ba3343fb81c4f8196446c58eca59191e (patch) | |
tree | 8a107227a391b998ad59bba6fceac49899805c35 /src/css/style.nim | |
parent | 355290ea8c9e51cf622ff1abf5f6fa626ca40565 (diff) | |
download | chawan-e6f7cc72ba3343fb81c4f8196446c58eca59191e.tar.gz |
It's broken but it could be worse
Diffstat (limited to 'src/css/style.nim')
-rw-r--r-- | src/css/style.nim | 56 |
1 files changed, 15 insertions, 41 deletions
diff --git a/src/css/style.nim b/src/css/style.nim index 6d6935d3..5f426e58 100644 --- a/src/css/style.nim +++ b/src/css/style.nim @@ -12,34 +12,6 @@ type unit*: CSSUnit auto*: bool - CSS2Properties* = ref object - rawtext*: string - fmttext*: seq[string] - x*: int - y*: int - ex*: int - ey*: int - width*: int - height*: int - hidden*: bool - before*: CSS2Properties - after*: CSS2Properties - margintop*: CSSLength - marginbottom*: CSSLength - marginleft*: CSSLength - marginright*: CSSLength - centered*: bool - display*: DisplayType - bold*: bool - fontStyle*: CSSFontStyle - underscore*: bool - islink*: bool - selected*: bool - indent*: int - color*: CSSColor - position*: CSSPosition - content*: seq[Rune] - CSSValues* = array[low(CSSRuleType)..high(CSSRuleType), CSSComputedValue] CSSColor* = tuple[r: uint8, g: uint8, b: uint8, a: uint8] @@ -59,6 +31,8 @@ type content*: seq[Rune] of VALUE_NONE: discard + CSSComputedValues* = array[low(CSSRuleType)..high(CSSRuleType), CSSComputedValue] + CSSSpecifiedValue* = object of CSSComputedValue hasGlobalValue: bool globalValue: CSSGlobalValueType @@ -79,7 +53,7 @@ const ValueTypes = { func getValueType*(rule: CSSRuleType): CSSValueType = return ValueTypes[rule] -func cells(l: CSSLength): int = +func cells*(l: CSSLength): int = case l.unit of UNIT_EM: return int(l.num) @@ -214,18 +188,18 @@ func cssLength(d: CSSDeclaration): CSSLength = return CSSLength(num: 0, unit: UNIT_EM) -func hasColor*(style: CSS2Properties): bool = - return style.color.r != 0 or style.color.b != 0 or style.color.g != 0 or style.color.a != 0 - -func termColor*(style: CSS2Properties): ForegroundColor = - if style.color.r > 120: - return fgRed - elif style.color.b > 120: - return fgBlue - elif style.color.g > 120: - return fgGreen - else: - return fgWhite +#func hasColor*(style: CSS2Properties): bool = +# return style.color.r != 0 or style.color.b != 0 or style.color.g != 0 or style.color.a != 0 +# +#func termColor*(style: CSS2Properties): ForegroundColor = +# if style.color.r > 120: +# return fgRed +# elif style.color.b > 120: +# return fgBlue +# elif style.color.g > 120: +# return fgGreen +# else: +# return fgWhite func isToken(d: CSSDeclaration): bool = d.value.len > 0 and d.value[0] of CSSToken func getToken(d: CSSDeclaration): CSSToken = (CSSToken)d.value[0] |