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

View file

@ -43,7 +43,7 @@ typedef struct letter_t {
typedef struct color_t {
const char* name;
int r, g, b, a;
int r, g, b;
int mono_rgb;
int gray_rgb;
} 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 )
{
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 );
}
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 );
}
@ -119,7 +119,7 @@ static void __draw_rect( int x, int y, int w, int h, int color )
rect.w = w;
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 );
}