summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-16 12:20:27 -0300
committerWerner Almesberger <werner@almesberger.net>2016-08-16 12:20:27 -0300
commit4868d9219622f2b31960bfe0528fc871e776683a (patch)
treebdc7fb026975f9a27290cd4dad3ec7b39fb2f852
parentcaf318ec523a7ef048edb453ba0dfae14337cb13 (diff)
downloadeeshow-4868d9219622f2b31960bfe0528fc871e776683a.tar.gz
eeshow-4868d9219622f2b31960bfe0528fc871e776683a.tar.bz2
eeshow-4868d9219622f2b31960bfe0528fc871e776683a.zip
eeshow/fig.c: output all user-defined colors
-rw-r--r--fig.c12
-rw-r--r--style.c3
-rw-r--r--style.h1
3 files changed, 11 insertions, 5 deletions
diff --git a/fig.c b/fig.c
index 859a5ce..4735c5c 100644
--- a/fig.c
+++ b/fig.c
@@ -201,10 +201,12 @@ static void fig_header(void)
}
-static void fig_color32(void)
+static void fig_colors(void)
{
- /* User32, COLOR_DARK_YELLOW */
- printf("0 32 #848400\n");
+ unsigned i;
+
+ for (i = 32; i != n_color_rgb; i++)
+ printf("0 %d #%06x\n", i, color_rgb[i]);
}
@@ -266,7 +268,7 @@ static void *fig_init(int argc, char *const *argv)
if (!template) {
fig_header();
- fig_color32();
+ fig_colors();
return NULL;
}
@@ -279,7 +281,7 @@ static void *fig_init(int argc, char *const *argv)
if (*buf == '#')
continue;
if (!--lines_to_colors)
- fig_color32();
+ fig_colors();
/*
* @@@ known bug: if the template is empty, we won't output
* color 32.
diff --git a/style.c b/style.c
index 3e0f21c..85f4138 100644
--- a/style.c
+++ b/style.c
@@ -12,6 +12,7 @@
#include <stdint.h>
+#include "util.h"
#include "style.h"
@@ -37,3 +38,5 @@ uint32_t color_rgb[] = {
[COLOR_DARK_YELLOW] = 0x848400,
[COLOR_LIGHT_GREY] = 0xd0d0d0,
};
+
+unsigned n_color_rgb = ARRAY_ELEMENTS(color_rgb);
diff --git a/style.h b/style.h
index cfeba00..80e3597 100644
--- a/style.h
+++ b/style.h
@@ -97,5 +97,6 @@
#define MISSING_HEIGHT 300
extern uint32_t color_rgb[];
+extern unsigned n_color_rgb;
#endif /* !STYLE_H */