]> gitweb.factorcode.org Git - factor.git/commitdiff
colors: fix issue introduced with spaces in names.
authorJohn Benediktsson <mrjbq7@gmail.com>
Tue, 11 Jan 2022 04:31:11 +0000 (20:31 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Tue, 11 Jan 2022 04:31:11 +0000 (20:31 -0800)
basis/colors/colors.factor

index 35bfebed61372060b1c49a692a92272a1da64160..7b3844c3014b944ed5205e7dcd9172309b4e38d0 100644 (file)
@@ -43,13 +43,12 @@ CONSTANT: transparent T{ rgba f 0.0 0.0 0.0 0.0 }
 <PRIVATE
 
 : parse-color ( line -- name color )
-    first4
-    [ [ string>number 255 /f ] tri@ 1.0 <rgba> ] dip
-    [ ascii:blank? ] trim-head H{ { CHAR: \s CHAR: - } } substitute swap ;
+    first4 [ [ string>number 255 /f ] tri@ 1.0 <rgba> ] dip swap ;
 
 : parse-colors ( lines -- assoc )
-    [ "!" head? ] reject
-    [ " \t" split harvest parse-color ] H{ } map>assoc ;
+    [ "!" head? ] reject [
+        [ blank? ] split-when harvest 3 cut "-" join suffix parse-color
+    ] H{ } map>assoc ;
 
 MEMO: colors ( -- assoc )
     {