code colors in hex, drop unused a channel

This commit is contained in:
Gwenhael Le Moine 2024-09-11 15:00:17 +02:00
parent 901ec9d8f4
commit d539fe6285
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
3 changed files with 205 additions and 245 deletions

442
src/ui.c
View file

@ -276,405 +276,365 @@ color_t colors_sx[ NB_COLORS ] = {
{ {
/* #ffffff */ /* #ffffff */
.name = "white", .name = "white",
.r = 255, .r = 0xff,
.g = 255, .g = 0xff,
.b = 255, .b = 0xff,
.a = 255, .mono_rgb = 0xff,
.mono_rgb = 255, .gray_rgb = 0xff,
.gray_rgb = 255,
}, },
{ {
/* #ffa600 */ /* #ffa600 */
.name = "left", .name = "left",
.r = 255, .r = 0xff,
.g = 166, .g = 0xa6,
.b = 0, .b = 0x00,
.a = 255, .mono_rgb = 0xff,
.mono_rgb = 255, .gray_rgb = 0xe6,
.gray_rgb = 230,
}, },
{ {
/* #00d2ff */ /* #00d2ff */
.name = "right", .name = "right",
.r = 0, .r = 0x00,
.g = 210, .g = 0xd2,
.b = 255, .b = 0xff,
.a = 255, .mono_rgb = 0xff,
.mono_rgb = 255, .gray_rgb = 0xa9,
.gray_rgb = 169,
}, },
{ {
/* #6d5d5d */ /* #6d5d5d */
.name = "but_top", .name = "but_top",
.r = 109, .r = 0x6d,
.g = 93, .g = 0x5d,
.b = 93, .b = 0x5d,
.a = 255, .mono_rgb = 0x00,
.mono_rgb = 0, .gray_rgb = 0x5b,
.gray_rgb = 91,
}, },
{ {
/* #5a4d4d */ /* #5a4d4d */
.name = "button", .name = "button",
.r = 90, .r = 0x5a,
.g = 77, .g = 0x4d,
.b = 77, .b = 0x4d,
.a = 255, .mono_rgb = 0x00,
.mono_rgb = 0, .gray_rgb = 0x51,
.gray_rgb = 81,
}, },
{ {
/* #4c4141 */ /* #4c4141 */
.name = "but_bot", .name = "but_bot",
.r = 76, .r = 0x4c,
.g = 65, .g = 0x41,
.b = 65, .b = 0x41,
.a = 255, .mono_rgb = 0x00,
.mono_rgb = 0, .gray_rgb = 0x45,
.gray_rgb = 69,
}, },
{ {
/* #cadd5c */ /* #cadd5c */
.name = "lcd_col", .name = "lcd_col",
.r = 202, .r = 0xca,
.g = 221, .g = 0xdd,
.b = 92, .b = 0x5c,
.a = 255, .mono_rgb = 0xff,
.mono_rgb = 255, .gray_rgb = 0xcd,
.gray_rgb = 205,
}, },
{ {
/* #000080 */ /* #000080 */
.name = "pix_col", .name = "pix_col",
.r = 0, .r = 0x00,
.g = 0, .g = 0x00,
.b = 128, .b = 0x80,
.a = 255, .mono_rgb = 0x00,
.mono_rgb = 0, .gray_rgb = 0x14,
.gray_rgb = 20,
}, },
{ {
/* #6d4e4e */ /* #6d4e4e */
.name = "pad_top", .name = "pad_top",
.r = 109, .r = 0x6d,
.g = 78, .g = 0x4e,
.b = 78, .b = 0x4e,
.a = 255, .mono_rgb = 0x00,
.mono_rgb = 0, .gray_rgb = 0x58,
.gray_rgb = 88,
}, },
{ {
/* #5a4040 */ /* #5a4040 */
.name = "pad", .name = "pad",
.r = 90, .r = 0x5a,
.g = 64, .g = 0x40,
.b = 64, .b = 0x40,
.a = 255, .mono_rgb = 0x00,
.mono_rgb = 0, .gray_rgb = 0x49,
.gray_rgb = 73,
}, },
{ {
/* #4c3636 */ /* #4c3636 */
.name = "pad_bot", .name = "pad_bot",
.r = 76, .r = 0x4c,
.g = 54, .g = 0x36,
.b = 54, .b = 0x36,
.a = 255, .mono_rgb = 0x00,
.mono_rgb = 0, .gray_rgb = 0x3c,
.gray_rgb = 60,
}, },
{ {
/* #9b7654 */ /* #9b7654 */
.name = "disp_pad_top", .name = "disp_pad_top",
.r = 155, .r = 0x9b,
.g = 118, .g = 0x76,
.b = 84, .b = 0x54,
.a = 255, .mono_rgb = 0x00,
.mono_rgb = 0, .gray_rgb = 0x7c,
.gray_rgb = 124,
}, },
{ {
/* #7c5e43 */ /* #7c5e43 */
.name = "disp_pad", .name = "disp_pad",
.r = 124, .r = 0x7c,
.g = 94, .g = 0x5e,
.b = 67, .b = 0x43,
.a = 255, .mono_rgb = 0x00,
.mono_rgb = 0, .gray_rgb = 0x63,
.gray_rgb = 99,
}, },
{ {
/* #644b35 */ /* #644b35 */
.name = "disp_pad_bot", .name = "disp_pad_bot",
.r = 100, .r = 0x64,
.g = 75, .g = 0x4b,
.b = 53, .b = 0x35,
.a = 255, .mono_rgb = 0x00,
.mono_rgb = 0, .gray_rgb = 0x4f,
.gray_rgb = 79,
}, },
{ {
/* #cca96b */ /* #cca96b */
.name = "logo", .name = "logo",
.r = 204, .r = 0xcc,
.g = 169, .g = 0xa9,
.b = 107, .b = 0x6b,
.a = 255, .mono_rgb = 0xff,
.mono_rgb = 255, .gray_rgb = 0xac,
.gray_rgb = 172,
}, },
{ {
/* #404040 */ /* #404040 */
.name = "logo_back", .name = "logo_back",
.r = 64, .r = 0x40,
.g = 64, .g = 0x40,
.b = 64, .b = 0x40,
.a = 255, .mono_rgb = 0x00,
.mono_rgb = 0, .gray_rgb = 0x41,
.gray_rgb = 65,
}, },
{ {
/* #cab890 */ /* #cab890 */
.name = "label", .name = "label",
.r = 202, .r = 0xca,
.g = 184, .g = 0xb8,
.b = 144, .b = 0x90,
.a = 255, .mono_rgb = 0xff,
.mono_rgb = 255, .gray_rgb = 0xb9,
.gray_rgb = 185,
}, },
{ {
/* #000000 */ /* #000000 */
.name = "frame", .name = "frame",
.r = 0, .r = 0x00,
.g = 0, .g = 0x00,
.b = 0, .b = 0x00,
.a = 255, .mono_rgb = 0xff,
.mono_rgb = 255, .gray_rgb = 0x00,
.gray_rgb = 0,
}, },
{ {
/* #3c2a2a */ /* #3c2a2a */
.name = "underlay", .name = "underlay",
.r = 60, .r = 0x3c,
.g = 42, .g = 0x2a,
.b = 42, .b = 0x2a,
.a = 255, .mono_rgb = 0x00,
.mono_rgb = 0, .gray_rgb = 0x30,
.gray_rgb = 48,
}, },
{ {
/* #000000 */ /* #000000 */
.name = "black", .name = "black",
.r = 0, .r = 0x00,
.g = 0, .g = 0x00,
.b = 0, .b = 0x00,
.a = 255, .mono_rgb = 0x00,
.mono_rgb = 0, .gray_rgb = 0x00,
.gray_rgb = 0,
}, },
}; };
color_t colors_gx[ NB_COLORS ] = { color_t colors_gx[ NB_COLORS ] = {
{ {
/* #FFFFFF */ /* #ffffff */
.name = "white", .name = "white",
.r = 255, .r = 0xff,
.g = 255, .g = 0xff,
.b = 255, .b = 0xff,
.a = 255, .mono_rgb = 0xff,
.mono_rgb = 255, .gray_rgb = 0xff,
.gray_rgb = 255,
}, },
{ {
/* #ffbaff */ /* #ffbaff */
.name = "left", .name = "left",
.r = 255, .r = 0xff,
.g = 186, .g = 0xba,
.b = 255, .b = 0xff,
.a = 255, .mono_rgb = 0xff,
.mono_rgb = 255, .gray_rgb = 0xdc,
.gray_rgb = 220,
}, },
{ {
/* #00ffcc */ /* #00ffcc */
.name = "right", .name = "right",
.r = 0, .r = 0x00,
.g = 255, .g = 0xff,
.b = 204, .b = 0xcc,
.a = 255, .mono_rgb = 0xff,
.mono_rgb = 255, .gray_rgb = 0xa9,
.gray_rgb = 169,
}, },
{ {
/* #646464 */ /* #646464 */
.name = "but_top", .name = "but_top",
.r = 104, .r = 0x64,
.g = 104, .g = 0x64,
.b = 104, .b = 0x64,
.a = 255, .mono_rgb = 0x00,
.mono_rgb = 0, .gray_rgb = 0x68,
.gray_rgb = 104,
}, },
{ {
/* #585858 */ /* #585858 */
.name = "button", .name = "button",
.r = 88, .r = 0x58,
.g = 88, .g = 0x58,
.b = 88, .b = 0x58,
.a = 255, .mono_rgb = 0x00,
.mono_rgb = 0, .gray_rgb = 0x58,
.gray_rgb = 88,
}, },
{ {
/* #4a4a4a */ /* #4a4a4a */
.name = "but_bot", .name = "but_bot",
.r = 74, .r = 0x4a,
.g = 74, .g = 0x4a,
.b = 74, .b = 0x4a,
.a = 255, .mono_rgb = 0x00,
.mono_rgb = 0, .gray_rgb = 0x4a,
.gray_rgb = 74,
}, },
{ {
/* #cadd5c */ /* #cadd5c */
.name = "lcd_col", .name = "lcd_col",
.r = 202, .r = 0xca,
.g = 221, .g = 0xdd,
.b = 92, .b = 0x5c,
.a = 255, .mono_rgb = 0xff,
.mono_rgb = 255, .gray_rgb = 0xcd,
.gray_rgb = 205,
}, },
{ {
/* #000080 */ /* #000080 */
.name = "pix_col", .name = "pix_col",
.r = 0, .r = 0x00,
.g = 0, .g = 0x00,
.b = 128, .b = 0x80,
.a = 255, .mono_rgb = 0x00,
.mono_rgb = 0, .gray_rgb = 0x14,
.gray_rgb = 20,
}, },
{ {
/* #585858 */ /* #585858 */
.name = "pad_top", .name = "pad_top",
.r = 88, .r = 0x58,
.g = 88, .g = 0x58,
.b = 88, .b = 0x58,
.a = 255, .mono_rgb = 0x00,
.mono_rgb = 0, .gray_rgb = 0x58,
.gray_rgb = 88,
}, },
{ {
/* #4a4a4a */ /* #4a4a4a */
.name = "pad", .name = "pad",
.r = 74, .r = 0x4a,
.g = 74, .g = 0x4a,
.b = 74, .b = 0x4a,
.a = 255, .mono_rgb = 0x00,
.mono_rgb = 0, .gray_rgb = 0x4a,
.gray_rgb = 74,
}, },
{ {
/* #404040 */ /* #404040 */
.name = "pad_bot", .name = "pad_bot",
.r = 64, .r = 0x40,
.g = 64, .g = 0x40,
.b = 64, .b = 0x40,
.a = 255, .mono_rgb = 0x00,
.mono_rgb = 0, .gray_rgb = 0x40,
.gray_rgb = 64,
}, },
{ {
/* #808080 */ /* #808080 */
.name = "disp_pad_top", .name = "disp_pad_top",
.r = 128, .r = 0x80,
.g = 128, .g = 0x80,
.b = 138, .b = 0x80,
.a = 255, .mono_rgb = 0x00,
.mono_rgb = 0, .gray_rgb = 0x80,
.gray_rgb = 128,
}, },
{ {
/* #68686E */ /* #68686E */
.name = "disp_pad", .name = "disp_pad",
.r = 104, .r = 0x68,
.g = 104, .g = 0x68,
.b = 110, .b = 0x6E,
.a = 255, .mono_rgb = 0x00,
.mono_rgb = 0, .gray_rgb = 0x68,
.gray_rgb = 104,
}, },
{ {
/* #54545a */ /* #54545a */
.name = "disp_pad_bot", .name = "disp_pad_bot",
.r = 84, .r = 0x54,
.g = 84, .g = 0x54,
.b = 90, .b = 0x5a,
.a = 255, .mono_rgb = 0x00,
.mono_rgb = 0, .gray_rgb = 0x54,
.gray_rgb = 84,
}, },
{ {
/* #b0b0b8 */ /* #b0b0b8 */
.name = "logo", .name = "logo",
.r = 176, .r = 0xb0,
.g = 176, .g = 0xb0,
.b = 184, .b = 0xb8,
.a = 255, .mono_rgb = 0xff,
.mono_rgb = 255, .gray_rgb = 0xb0,
.gray_rgb = 176,
}, },
{ {
/* #68686e */ /* #68686e */
.name = "logo_back", .name = "logo_back",
.r = 104, .r = 0x68,
.g = 104, .g = 0x68,
.b = 110, .b = 0x6e,
.a = 255, .mono_rgb = 0x00,
.mono_rgb = 0, .gray_rgb = 0x68,
.gray_rgb = 104,
}, },
{ {
/* #f0f0f0 */ /* #f0f0f0 */
.name = "label", .name = "label",
.r = 240, .r = 0xf0,
.g = 240, .g = 0xf0,
.b = 240, .b = 0xf0,
.a = 255, .mono_rgb = 0xff,
.mono_rgb = 255, .gray_rgb = 0xf0,
.gray_rgb = 240,
}, },
{ {
/* #000000 */ /* #000000 */
.name = "frame", .name = "frame",
.r = 0, .r = 0x00,
.g = 0, .g = 0x00,
.b = 0, .b = 0x00,
.a = 255, .mono_rgb = 0xff,
.mono_rgb = 255, .gray_rgb = 0x00,
.gray_rgb = 0,
}, },
{ {
/* #68686e */ /* #68686e */
.name = "underlay", .name = "underlay",
.r = 104, .r = 0x68,
.g = 104, .g = 0x68,
.b = 110, .b = 0x6e,
.a = 255, .mono_rgb = 0x00,
.mono_rgb = 0, .gray_rgb = 0x68,
.gray_rgb = 104,
}, },
{ {
/* #000000 */ /* #000000 */
.name = "black", .name = "black",
.r = 0, .r = 0x00,
.g = 0, .g = 0x00,
.b = 0, .b = 0x00,
.a = 255, .mono_rgb = 0x00,
.mono_rgb = 0, .gray_rgb = 0x00,
.gray_rgb = 0,
}, },
}; };

View file

@ -43,7 +43,7 @@ typedef struct letter_t {
typedef struct color_t { typedef struct color_t {
const char* name; const char* name;
int r, g, b, a; int r, g, b;
int mono_rgb; int mono_rgb;
int gray_rgb; int gray_rgb;
} color_t; } color_t;

View file

@ -101,13 +101,13 @@ static SDL_Texture* bitmap_to_texture( unsigned int w, unsigned int h, unsigned
static void __draw_pixel( int x, int y, int color ) static void __draw_pixel( int x, int y, int color )
{ {
SDL_SetRenderDrawColor( renderer, colors[ color ].r, colors[ color ].g, colors[ color ].b, colors[ color ].a ); SDL_SetRenderDrawColor( renderer, colors[ color ].r, colors[ color ].g, colors[ color ].b, 0xff );
SDL_RenderDrawPoint( renderer, x, y ); SDL_RenderDrawPoint( renderer, x, y );
} }
static void __draw_line( int x1, int y1, int x2, int y2, int color ) static void __draw_line( int x1, int y1, int x2, int y2, int color )
{ {
SDL_SetRenderDrawColor( renderer, colors[ color ].r, colors[ color ].g, colors[ color ].b, colors[ color ].a ); SDL_SetRenderDrawColor( renderer, colors[ color ].r, colors[ color ].g, colors[ color ].b, 0xff );
SDL_RenderDrawLine( renderer, x1, y1, x2, y2 ); SDL_RenderDrawLine( renderer, x1, y1, x2, y2 );
} }
@ -119,7 +119,7 @@ static void __draw_rect( int x, int y, int w, int h, int color )
rect.w = w; rect.w = w;
rect.h = h; rect.h = h;
SDL_SetRenderDrawColor( renderer, colors[ color ].r, colors[ color ].g, colors[ color ].b, colors[ color ].a ); SDL_SetRenderDrawColor( renderer, colors[ color ].r, colors[ color ].g, colors[ color ].b, 0xff );
SDL_RenderFillRect( renderer, &rect ); SDL_RenderFillRect( renderer, &rect );
} }