1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-17 21:16:15 +02:00

eeshow/fig.c: output all user-defined colors

This commit is contained in:
Werner Almesberger 2016-08-16 12:20:27 -03:00
parent 5edf1923f0
commit f08f43d706
3 changed files with 11 additions and 5 deletions

View File

@ -201,10 +201,12 @@ static void fig_header(void)
} }
static void fig_color32(void) static void fig_colors(void)
{ {
/* User32, COLOR_DARK_YELLOW */ unsigned i;
printf("0 32 #848400\n");
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) { if (!template) {
fig_header(); fig_header();
fig_color32(); fig_colors();
return NULL; return NULL;
} }
@ -279,7 +281,7 @@ static void *fig_init(int argc, char *const *argv)
if (*buf == '#') if (*buf == '#')
continue; continue;
if (!--lines_to_colors) if (!--lines_to_colors)
fig_color32(); fig_colors();
/* /*
* @@@ known bug: if the template is empty, we won't output * @@@ known bug: if the template is empty, we won't output
* color 32. * color 32.

View File

@ -12,6 +12,7 @@
#include <stdint.h> #include <stdint.h>
#include "util.h"
#include "style.h" #include "style.h"
@ -37,3 +38,5 @@ uint32_t color_rgb[] = {
[COLOR_DARK_YELLOW] = 0x848400, [COLOR_DARK_YELLOW] = 0x848400,
[COLOR_LIGHT_GREY] = 0xd0d0d0, [COLOR_LIGHT_GREY] = 0xd0d0d0,
}; };
unsigned n_color_rgb = ARRAY_ELEMENTS(color_rgb);

View File

@ -97,5 +97,6 @@
#define MISSING_HEIGHT 300 #define MISSING_HEIGHT 300
extern uint32_t color_rgb[]; extern uint32_t color_rgb[];
extern unsigned n_color_rgb;
#endif /* !STYLE_H */ #endif /* !STYLE_H */