spv-css-parser: Parse text color also.
authorBen Pfaff <blp@cs.stanford.edu>
Tue, 29 Dec 2020 18:48:07 +0000 (10:48 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Tue, 29 Dec 2020 18:49:07 +0000 (10:49 -0800)
src/output/spv/spv-css-parser.c

index 19b0b4715fa7c4d538f5f9d82a87bc750a1542cd..4eaef8d612ae2e7f185bd7e2341401e76ecff908 100644 (file)
@@ -22,6 +22,7 @@
 #include <string.h>
 
 #include "libpspp/str.h"
+#include "output/options.h"
 #include "output/pivot-table.h"
 #include "spv.h"
 
@@ -114,7 +115,13 @@ static void
 css_decode_key_value (const char *key, const char *value,
                       struct font_style *font)
 {
-  if (!strcmp (key, "font-weight"))
+  if (!strcmp (key, "color"))
+    {
+      struct cell_color color;
+      if (parse_color__ (value, &color))
+        font->fg[0] = font->bg[0] = color;
+    }
+  else if (!strcmp (key, "font-weight"))
     font->bold = !strcmp (value, "bold");
   else if (!strcmp (key, "font-style"))
     font->italic = !strcmp (value, "italic");
@@ -128,7 +135,7 @@ css_decode_key_value (const char *key, const char *value,
   else if (!strcmp (key, "font-size"))
     font->size = atoi (value) * 3 / 4;
 
-  /* fg_color, bg_color */
+  /* bg_color */
 
 }