about summary refs log tree commit diff stats
path: root/src/types
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2022-11-25 23:15:49 +0100
committerbptato <nincsnevem662@gmail.com>2022-11-25 23:16:39 +0100
commitd54e0258fd794ad54b42acc51ec65d9c7297d908 (patch)
tree028ec9ce0dc9ba77d23bea2e3f86e4aabb527b4b /src/types
parent7ab7f28fdefe503fdde53ba9e253e308cb06b44f (diff)
downloadchawan-d54e0258fd794ad54b42acc51ec65d9c7297d908.tar.gz
Fix some table layout issues
Diffstat (limited to 'src/types')
-rw-r--r--src/types/color.nim16
1 files changed, 3 insertions, 13 deletions
diff --git a/src/types/color.nim b/src/types/color.nim
index e85a254e..9273c794 100644
--- a/src/types/color.nim
+++ b/src/types/color.nim
@@ -258,24 +258,14 @@ func parseLegacyColor*(s: string): Option[RGBColor] =
         (hexValue(s[1]) * 17 shl 8) or
         (hexValue(s[2]) * 17)
       return some(RGBColor(c))
-  block sane:
-    var c: Option[RGBAColor]
-    for c in s:
-      if hexValue(c) == -1:
-        break sane
-    if s[0] == '#' and s.len == 8:
-      c = parseHexColor(s[1..^1])
-    elif s.len == 8:
-      c = parseHexColor(s)
-    else:
-      break sane
-    if c.isSome:
-      return some(RGBColor(c.get))
   # Seriously, what the hell.
   var s2 = if s[0] == '#':
     s.substr(1)
   else:
     s
+  for i in 0 ..< s2.len:
+    if hexValue(s2[i]) == -1:
+      s2[i] = '0'
   while s2.len == 0 or s2.len mod 3 != 0:
     s2 &= '0'
   var l = s2.len div 3