output: Add support for colors in cells.
[pspp] / src / output / table-provider.h
index a511e13bd5c95439dc0504b91abb64f414e7aedf..9a790612287033a2db29fcfe269d62a6b54ae36c 100644 (file)
@@ -17,6 +17,7 @@
 #ifndef OUTPUT_TABLE_PROVIDER
 #define OUTPUT_TABLE_PROVIDER 1
 
+#include <stdint.h>
 #include "output/table.h"
 
 struct string;
@@ -42,6 +43,26 @@ struct cell_contents
 void cell_contents_format_footnote_markers (const struct cell_contents *,
                                             struct string *);
 
+struct cell_color
+  {
+    uint8_t r, g, b;
+  };
+
+#define CELL_COLOR(r, g, b) (struct cell_color) { r, g, b }
+#define CELL_COLOR_BLACK CELL_COLOR (0, 0, 0)
+#define CELL_COLOR_WHITE CELL_COLOR (255, 255, 255)
+
+static inline bool
+cell_color_equal (const struct cell_color *a, const struct cell_color *b)
+{
+  return a->r == b->r && a->g == b->g && a->b == b->b;
+}
+
+struct cell_style
+  {
+    struct cell_color fg, bg;
+  };
+
 /* A cell in a table. */
 struct table_cell
   {
@@ -75,6 +96,8 @@ struct table_cell
     size_t n_contents;
     struct cell_contents inline_contents;
 
+    const struct cell_style *style;
+
     /* Called to free the cell's data, if nonnull. */
     void (*destructor) (void *destructor_aux);
     void *destructor_aux;