aboutsummaryrefslogtreecommitdiffstats
path: root/src/css
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-02-25 15:15:27 +0100
committerbptato <nincsnevem662@gmail.com>2024-02-25 15:22:00 +0100
commited6c9ef56eec768803b17abd808039d95227b4a4 (patch)
tree376a476a744d2c61818dc29a64e8fc3d4e1286a2 /src/css
parent7578dfba943c0ccf46c6a6a10c470c432a403dad (diff)
downloadchawan-ed6c9ef56eec768803b17abd808039d95227b4a4.tar.gz
css: always use defaultColor as the initial color
This way, we do not end up with ugly contrast-corrected white on terminals with arbitrary backgrounds by default. (Now we get the native -cha-ansi(default) instead). (We leave background-color as transparent; this should have the same effect, since defaultColor as bgcolor is ignored, but makes more sense (and will allow us to un-ignore defaultColor as bgcolor in the future.))
Diffstat (limited to 'src/css')
-rw-r--r--src/css/values.nim11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/css/values.nim b/src/css/values.nim
index a7296b8e..c53825ee 100644
--- a/src/css/values.nim
+++ b/src/css/values.nim
@@ -1254,13 +1254,9 @@ proc getValueFromDecl(val: CSSComputedValue, d: CSSDeclaration,
return ok()
func getInitialColor(t: CSSPropertyType): CellColor =
- case t
- of PROPERTY_COLOR:
- return Colors["white"].cellColor()
- of PROPERTY_BACKGROUND_COLOR:
+ if t == PROPERTY_BACKGROUND_COLOR:
return Colors["transparent"].cellColor()
- else:
- return Colors["black"].cellColor()
+ return defaultColor
func getInitialLength(t: CSSPropertyType): CSSLength =
case t
@@ -1278,7 +1274,8 @@ func getInitialInteger(t: CSSPropertyType): int =
return 1
of PROPERTY_FONT_WEIGHT:
return 400 # normal
- else: discard
+ else:
+ return 0
func calcInitial(t: CSSPropertyType): CSSComputedValue =
let v = valueType(t)