store colors in 0xRRGGBB format

This commit is contained in:
Gwenhael Le Moine 2024-10-10 12:16:50 +02:00
parent 77b6998ba8
commit 0dfb431aa3
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
6 changed files with 89 additions and 215 deletions

View file

@ -3,201 +3,157 @@
color_t colors_48gx[ NB_COLORS ] = {
/* UI4X_COLOR_HP_LOGO */
{
.r = 0xB0,
.g = 0xB0,
.b = 0xB8,
.a = 0xFF,
.mono_rgb = 0xFF,
.gray_rgb = 0xB0,
.rgb = 0xB0B0B8,
},
/* UI4X_COLOR_HP_LOGO_BG */
{
.r = 0x68,
.g = 0x68,
.b = 0x6E,
.a = 0xFF,
.mono_rgb = 0x0,
.gray_rgb = 0x68,
.rgb = 0x68686E,
},
/* UI4X_COLOR_48GX_128K_RAM */
{
.r = 0xF0,
.g = 0xF0,
.b = 0xF0,
.a = 0xFF,
.mono_rgb = 0xFF,
.gray_rgb = 0xF0,
.rgb = 0xF0F0F0,
},
/* UI4X_COLOR_FRAME */
{
.r = 0x0,
.g = 0x0,
.b = 0x0,
.a = 0xFF,
.mono_rgb = 0xFF,
.gray_rgb = 0x0,
.rgb = 0x000000,
},
/* UI4X_COLOR_UPPER_FACEPLATE_EDGE_TOP */
{
.r = 0x80,
.g = 0x80,
.b = 0x8A,
.a = 0xFF,
.mono_rgb = 0x0,
.gray_rgb = 0x80,
.rgb = 0x80808A,
},
/* UI4X_COLOR_UPPER_FACEPLATE */
{
.r = 0x68,
.g = 0x68,
.b = 0x6E,
.a = 0xFF,
.mono_rgb = 0x0,
.gray_rgb = 0x68,
.rgb = 0x68686E,
},
/* UI4X_COLOR_UPPER_FACEPLATE_EDGE_BOTTOM */
{
.r = 0x54,
.g = 0x54,
.b = 0x5A,
.a = 0xFF,
.mono_rgb = 0x0,
.gray_rgb = 0x54,
.rgb = 0x54545A,
},
/* UI4X_COLOR_FACEPLATE_EDGE_TOP */
{
.r = 0x58,
.g = 0x58,
.b = 0x58,
.a = 0xFF,
.mono_rgb = 0x0,
.gray_rgb = 0x58,
.rgb = 0x585858,
},
/* UI4X_COLOR_FACEPLATE */
{
.r = 0x4A,
.g = 0x4A,
.b = 0x4A,
.a = 0xFF,
.mono_rgb = 0x0,
.gray_rgb = 0x4A,
.rgb = 0x4A4A4A,
},
/* UI4X_COLOR_FACEPLATE_EDGE_BOTTOM */
{
.r = 0x40,
.g = 0x40,
.b = 0x40,
.a = 0xFF,
.mono_rgb = 0x0,
.gray_rgb = 0x40,
.rgb = 0x404040,
},
/* UI4X_COLOR_KEYPAD_HIGHLIGHT */
{
.r = 0x68,
.g = 0x68,
.b = 0x6E,
.a = 0xFF,
.mono_rgb = 0x0,
.gray_rgb = 0x68,
.rgb = 0x68686E,
},
/* UI4X_COLOR_BUTTON_EDGE_TOP */
{
.r = 0x68,
.g = 0x68,
.b = 0x68,
.a = 0xFF,
.mono_rgb = 0x0,
.gray_rgb = 0x68,
.rgb = 0x686868,
},
/* UI4X_COLOR_BUTTON */
{
.r = 0x58,
.g = 0x58,
.b = 0x58,
.a = 0xFF,
.mono_rgb = 0x0,
.gray_rgb = 0x58,
.rgb = 0x585858,
},
/* UI4X_COLOR_BUTTON_EDGE_BOTTOM */
{
.r = 0x4A,
.g = 0x4A,
.b = 0x4A,
.a = 0xFF,
.mono_rgb = 0x0,
.gray_rgb = 0x4A,
.rgb = 0x4A4A4A,
},
/* UI4X_COLOR_PIXEL_OFF */
{
.r = 0xCA,
.g = 0xDD,
.b = 0x5C,
.a = 0xFF,
.mono_rgb = 0xFF,
.gray_rgb = 0xCD,
.rgb = 0xCADD5C,
},
/* UI4X_COLOR_PIXEL_ON */
{
.r = 0x0,
.g = 0x0,
.b = 0x80,
.a = 0xFF,
.mono_rgb = 0x0,
.gray_rgb = 0x14,
.rgb = 0x000080,
},
/* UI4X_COLOR_BLACK_PIXEL_OFF */
{
.r = 0xf5,
.g = 0xf5,
.b = 0xf5,
.a = 0xFF,
.mono_rgb = 0xFF,
.gray_rgb = 0xCD,
.rgb = 0xf5f5f5,
},
/* UI4X_COLOR_BLACK_PIXEL_ON */
{
.r = 0x0,
.g = 0x0,
.b = 0x0,
.a = 0xFF,
.mono_rgb = 0x0,
.gray_rgb = 0x14,
.rgb = 0x000000,
},
/* UI4X_COLOR_LABEL */
{
.r = 0xFF,
.g = 0xFF,
.b = 0xFF,
.a = 0xFF,
.mono_rgb = 0xFF,
.gray_rgb = 0xFF,
.rgb = 0xFFFFFF,
},
/* UI4X_COLOR_ALPHA */
{
.r = 0xFF,
.g = 0xFF,
.b = 0xFF,
.a = 0xFF,
.mono_rgb = 0xFF,
.gray_rgb = 0xFF,
.rgb = 0xFFFFFF,
},
/* UI4X_COLOR_SHIFT_LEFT */
{
.r = 0xFF,
.g = 0xBA,
.b = 0xFF,
.a = 0xFF,
.mono_rgb = 0xFF,
.gray_rgb = 0xDC,
.rgb = 0xFFBAFF,
},
/* UI4X_COLOR_SHIFT_RIGHT */
{
.r = 0x0,
.g = 0xFF,
.b = 0xCC,
.a = 0xFF,
.mono_rgb = 0xFF,
.gray_rgb = 0xA9,
.rgb = 0x00FFCC,
},
};

View file

@ -3,201 +3,157 @@
color_t colors_48sx[ NB_COLORS ] = {
/* UI4X_COLOR_HP_LOGO */
{
.r = 0xCC,
.g = 0xA9,
.b = 0x6B,
.a = 0xFF,
.mono_rgb = 0xFF,
.gray_rgb = 0xAC,
.rgb = 0xCCA96B,
},
/* UI4X_COLOR_HP_LOGO_BG */
{
.r = 0x40,
.g = 0x40,
.b = 0x40,
.a = 0xFF,
.mono_rgb = 0x0,
.mono_rgb = 0x00,
.gray_rgb = 0x41,
.rgb = 0x404040,
},
/* UI4X_COLOR_48GX_128K_RAM */
{
.r = 0xCA,
.g = 0xB8,
.b = 0x90,
.a = 0xFF,
.mono_rgb = 0xFF,
.gray_rgb = 0xB9,
.rgb = 0xCAB890,
},
/* UI4X_COLOR_FRAME */
{
.r = 0x0,
.g = 0x0,
.b = 0x0,
.a = 0xFF,
.mono_rgb = 0xFF,
.gray_rgb = 0x0,
.gray_rgb = 0x00,
.rgb = 0x000000,
},
/* UI4X_COLOR_UPPER_FACEPLATE_EDGE_TOP */
{
.r = 0x9B,
.g = 0x76,
.b = 0x54,
.a = 0xFF,
.mono_rgb = 0x0,
.mono_rgb = 0x00,
.gray_rgb = 0x7C,
.rgb = 0x9B7654,
},
/* UI4X_COLOR_UPPER_FACEPLATE */
{
.r = 0x7C,
.g = 0x5E,
.b = 0x43,
.a = 0xFF,
.mono_rgb = 0x0,
.mono_rgb = 0x00,
.gray_rgb = 0x63,
.rgb = 0x7C5E43,
},
/* UI4X_COLOR_UPPER_FACEPLATE_EDGE_BOTTOM */
{
.r = 0x64,
.g = 0x4B,
.b = 0x35,
.a = 0xFF,
.mono_rgb = 0x0,
.mono_rgb = 0x00,
.gray_rgb = 0x4F,
.rgb = 0x644B35,
},
/* UI4X_COLOR_FACEPLATE_EDGE_TOP */
{
.r = 0x6D,
.g = 0x4E,
.b = 0x4E,
.a = 0xFF,
.mono_rgb = 0x0,
.mono_rgb = 0x00,
.gray_rgb = 0x58,
.rgb = 0x6D4E4E,
},
/* UI4X_COLOR_FACEPLATE */
{
.r = 0x5A,
.g = 0x40,
.b = 0x40,
.a = 0xFF,
.mono_rgb = 0x0,
.mono_rgb = 0x00,
.gray_rgb = 0x49,
.rgb = 0x5A4040,
},
/* UI4X_COLOR_FACEPLATE_EDGE_BOTTOM */
{
.r = 0x4C,
.g = 0x36,
.b = 0x36,
.a = 0xFF,
.mono_rgb = 0x0,
.mono_rgb = 0x00,
.gray_rgb = 0x3C,
.rgb = 0x4C3636,
},
/* UI4X_COLOR_KEYPAD_HIGHLIGHT */
{
.r = 0x3C,
.g = 0x2A,
.b = 0x2A,
.a = 0xFF,
.mono_rgb = 0x0,
.mono_rgb = 0x00,
.gray_rgb = 0x30,
.rgb = 0x3C2A2A,
},
/* UI4X_COLOR_BUTTON_EDGE_TOP */
{
.r = 0x6D,
.g = 0x5D,
.b = 0x5D,
.a = 0xFF,
.mono_rgb = 0x0,
.mono_rgb = 0x00,
.gray_rgb = 0x5B,
.rgb = 0x6D5D5D,
},
/* UI4X_COLOR_BUTTON */
{
.r = 0x5A,
.g = 0x4D,
.b = 0x4D,
.a = 0xFF,
.mono_rgb = 0x0,
.mono_rgb = 0x00,
.gray_rgb = 0x51,
.rgb = 0x5A4D4D,
},
/* UI4X_COLOR_BUTTON_EDGE_BOTTOM */
{
.r = 0x4C,
.g = 0x41,
.b = 0x41,
.a = 0xFF,
.mono_rgb = 0x0,
.mono_rgb = 0x00,
.gray_rgb = 0x45,
.rgb = 0x4C4141,
},
/* UI4X_COLOR_PIXEL_OFF */
{
.r = 0xCA,
.g = 0xDD,
.b = 0x5C,
.a = 0xFF,
.mono_rgb = 0xFF,
.gray_rgb = 0xCD,
.rgb = 0xCADD5C,
},
/* UI4X_COLOR_PIXEL_ON */
{
.r = 0x0,
.g = 0x0,
.b = 0x80,
.a = 0xFF,
.mono_rgb = 0x0,
.mono_rgb = 0x00,
.gray_rgb = 0x14,
.rgb = 0x000080,
},
/* UI4X_COLOR_BLACK_PIXEL_OFF */
{
.r = 0xf5,
.g = 0xf5,
.b = 0xf5,
.a = 0xFF,
.mono_rgb = 0xFF,
.gray_rgb = 0xCD,
.rgb = 0xf5f5f5,
},
/* UI4X_COLOR_BLACK_PIXEL_ON */
{
.r = 0x0,
.g = 0x0,
.b = 0x0,
.a = 0xFF,
.mono_rgb = 0x0,
.mono_rgb = 0x00,
.gray_rgb = 0x14,
.rgb = 0x000000,
},
/* UI4X_COLOR_LABEL */
{
.r = 0xFF,
.g = 0xFF,
.b = 0xFF,
.a = 0xFF,
.mono_rgb = 0xFF,
.gray_rgb = 0xFF,
.rgb = 0xFFFFFF,
},
/* UI4X_COLOR_ALPHA */
{
.r = 0xFF,
.g = 0xFF,
.b = 0xFF,
.a = 0xFF,
.mono_rgb = 0xFF,
.gray_rgb = 0xFF,
.rgb = 0xFFFFFF,
},
/* UI4X_COLOR_SHIFT_LEFT */
{
.r = 0xFF,
.g = 0xA6,
.b = 0x0,
.a = 0xFF,
.mono_rgb = 0xFF,
.gray_rgb = 0xE6,
.rgb = 0xFFA600,
},
/* UI4X_COLOR_SHIFT_RIGHT */
{
.r = 0x0,
.g = 0xD2,
.b = 0xFF,
.a = 0xFF,
.mono_rgb = 0xFF,
.gray_rgb = 0xA9,
.rgb = 0x00D2FF,
},
};

View file

@ -3,201 +3,157 @@
color_t colors_49g[ NB_COLORS ] = {
/* UI4X_COLOR_HP_LOGO */
{
.r = 0xB0,
.g = 0xB0,
.b = 0xB8,
.a = 0xff,
.mono_rgb = 0xff,
.gray_rgb = 0xB0,
.rgb = 0xB0B0B8,
},
/* UI4X_COLOR_HP_LOGO_BG */
{
.r = 0x13,
.g = 0x13,
.b = 0x13,
.a = 0xff,
.mono_rgb = 0x00,
.gray_rgb = 0x68,
.rgb = 0x131313,
},
/* UI4X_COLOR_48GX_128K_RAM */
{
.r = 0xF0,
.g = 0xF0,
.b = 0xF0,
.a = 0xff,
.mono_rgb = 0xff,
.gray_rgb = 0xF0,
.rgb = 0xF0F0F0,
},
/* UI4X_COLOR_FRAME */
{
.r = 0x00,
.g = 0x00,
.b = 0x00,
.a = 0xff,
.mono_rgb = 0xff,
.gray_rgb = 0x00,
.rgb = 0x000000,
},
/* UI4X_COLOR_UPPER_FACEPLATE_EDGE_TOP */
{
.r = 0x00,
.g = 0x00,
.b = 0x00,
.a = 0xff,
.mono_rgb = 0x00,
.gray_rgb = 0x80,
.rgb = 0x000000,
},
/* UI4X_COLOR_UPPER_FACEPLATE */
{
.r = 0x26,
.g = 0x26,
.b = 0x26,
.a = 0xff,
.mono_rgb = 0x00,
.gray_rgb = 0x68,
.rgb = 0x262626,
},
/* UI4X_COLOR_UPPER_FACEPLATE_EDGE_BOTTOM */
{
.r = 0x00,
.g = 0x00,
.b = 0x00,
.a = 0xff,
.mono_rgb = 0x00,
.gray_rgb = 0x54,
.rgb = 0x000000,
},
/* UI4X_COLOR_FACEPLATE_EDGE_TOP */
{
.r = 0x58,
.g = 0x58,
.b = 0x58,
.a = 0xff,
.mono_rgb = 0x00,
.gray_rgb = 0x58,
.rgb = 0x585858,
},
/* UI4X_COLOR_FACEPLATE */
{
.r = 0x27,
.g = 0x27,
.b = 0x27,
.a = 0xff,
.mono_rgb = 0x00,
.gray_rgb = 0x4A,
.rgb = 0x272727,
},
/* UI4X_COLOR_FACEPLATE_EDGE_BOTTOM */
{
.r = 0x40,
.g = 0x40,
.b = 0x40,
.a = 0xff,
.mono_rgb = 0x00,
.gray_rgb = 0x40,
.rgb = 0x404040,
},
/* UI4X_COLOR_KEYPAD_HIGHLIGHT */
{
.r = 0x4f,
.g = 0x61,
.b = 0x65,
.a = 0xff,
.mono_rgb = 0x00,
.gray_rgb = 0x68,
.rgb = 0x4f6165,
},
/* UI4X_COLOR_BUTTON_EDGE_TOP */
{
.r = 0x4b,
.g = 0x4b,
.b = 0x4b,
.a = 0xff,
.mono_rgb = 0x00,
.gray_rgb = 0x68,
.rgb = 0x4b4b4b,
},
/* UI4X_COLOR_BUTTON */
{
.r = 0x3f,
.g = 0x3f,
.b = 0x3f,
.a = 0xff,
.mono_rgb = 0x00,
.gray_rgb = 0x58,
.rgb = 0x3f3f3f,
},
/* UI4X_COLOR_BUTTON_EDGE_BOTTOM */
{
.r = 0x3d,
.g = 0x3d,
.b = 0x3d,
.a = 0xff,
.mono_rgb = 0x00,
.gray_rgb = 0x4A,
.rgb = 0x3d3d3d,
},
/* UI4X_COLOR_PIXEL_OFF */
{
.r = 0xcd,
.g = 0xcd,
.b = 0xcd,
.a = 0xff,
.mono_rgb = 0xff,
.gray_rgb = 0xCD,
.rgb = 0xcdcdcd,
},
/* UI4X_COLOR_PIXEL_ON */
{
.r = 0x00,
.g = 0x00,
.b = 0x00,
.a = 0xff,
.mono_rgb = 0x00,
.gray_rgb = 0x14,
.rgb = 0x000000,
},
/* UI4X_COLOR_BLACK_PIXEL_OFF */
{
.r = 0xf5,
.g = 0xf5,
.b = 0xf5,
.a = 0xFF,
.mono_rgb = 0xFF,
.gray_rgb = 0xCD,
.rgb = 0xf5f5f5,
},
/* UI4X_COLOR_BLACK_PIXEL_ON */
{
.r = 0x0,
.g = 0x0,
.b = 0x0,
.a = 0xFF,
.mono_rgb = 0x0,
.gray_rgb = 0x14,
.rgb = 0x000000,
},
/* UI4X_COLOR_LABEL */
{
.r = 0xff,
.g = 0xff,
.b = 0xff,
.a = 0xff,
.mono_rgb = 0xff,
.gray_rgb = 0xff,
.rgb = 0xffffff,
},
/* UI4X_COLOR_ALPHA */
{
.r = 0x67,
.g = 0xc1,
.b = 0x84,
.a = 0xff,
.mono_rgb = 0xff,
.gray_rgb = 0xDC,
.rgb = 0x67c184,
},
/* UI4X_COLOR_SHIFT_LEFT */
{
.r = 0x82,
.g = 0xb1,
.b = 0xff,
.a = 0xff,
.mono_rgb = 0xff,
.gray_rgb = 0xDC,
.rgb = 0x82b1ff,
},
/* UI4X_COLOR_SHIFT_RIGHT */
{
.r = 0xff,
.g = 0x8a,
.b = 0x80,
.a = 0xff,
.mono_rgb = 0xff,
.gray_rgb = 0xA9,
.rgb = 0xff8a80,
},
};

View file

@ -50,6 +50,7 @@ typedef struct color_t {
int r, g, b, a;
int mono_rgb;
int gray_rgb;
int rgb;
} color_t;
typedef struct button_t {

View file

@ -479,9 +479,10 @@ void ui_start_ncurses( config_t* conf )
init_color( LCD_COLOR_FG, COLORS[ UI4X_COLOR_PIXEL_ON ].gray_rgb, COLORS[ UI4X_COLOR_PIXEL_ON ].gray_rgb,
COLORS[ UI4X_COLOR_PIXEL_ON ].gray_rgb );
} else {
init_color( LCD_COLOR_BG, COLORS[ UI4X_COLOR_PIXEL_OFF ].r, COLORS[ UI4X_COLOR_PIXEL_OFF ].g,
COLORS[ UI4X_COLOR_PIXEL_OFF ].b );
init_color( LCD_COLOR_FG, COLORS[ UI4X_COLOR_PIXEL_ON ].r, COLORS[ UI4X_COLOR_PIXEL_ON ].g, COLORS[ UI4X_COLOR_PIXEL_ON ].b );
init_color( LCD_COLOR_BG, ( COLORS[ UI4X_COLOR_PIXEL_OFF ].rgb >> 16 ) & 0xff,
( COLORS[ UI4X_COLOR_PIXEL_OFF ].rgb >> 8 ) & 0xff, COLORS[ UI4X_COLOR_PIXEL_OFF ].rgb & 0xff );
init_color( LCD_COLOR_BG, ( COLORS[ UI4X_COLOR_PIXEL_ON ].rgb >> 16 ) & 0xff, ( COLORS[ UI4X_COLOR_PIXEL_ON ].rgb >> 8 ) & 0xff,
COLORS[ UI4X_COLOR_PIXEL_ON ].rgb & 0xff );
}
init_pair( LCD_PIXEL_OFF, LCD_COLOR_BG, LCD_COLOR_BG );

View file

@ -973,6 +973,10 @@ static void apply_contrast( void )
colors[ i ].r = colors[ i ].gray_rgb;
colors[ i ].g = colors[ i ].gray_rgb;
colors[ i ].b = colors[ i ].gray_rgb;
} else {
colors[ i ].r = ( colors[ i ].rgb >> 16 ) & 0xff;
colors[ i ].g = ( colors[ i ].rgb >> 8 ) & 0xff;
colors[ i ].b = colors[ i ].rgb & 0xff;
}
if ( !config.mono && i == COLOR_PIXEL_ON ) {