- colors_custom: rework colors; use Google Material Palette

TODO: make custom colors themable
Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
svenhoefer
2021-11-19 21:51:01 +01:00
committed by Thilo Graf
parent 4e951f462b
commit 89b385eeee
5 changed files with 102 additions and 93 deletions

View File

@@ -180,24 +180,26 @@ void CFrameBuffer::init(const char * const fbDevice)
goto nolfb;
}
/* Windows Colors */
paletteSetColor(0x1, 0x010101, tr);
paletteSetColor(0x2, 0x800000, tr);
paletteSetColor(0x3, 0x008000, tr);
paletteSetColor(0x4, 0x808000, tr);
paletteSetColor(0x5, 0x000080, tr);
paletteSetColor(0x6, 0x800080, tr);
paletteSetColor(0x7, 0x008080, tr);
paletteSetColor(0x8, 0xA0A0A0, tr);
paletteSetColor(0x9, 0x505050, tr);
paletteSetColor(0xA, 0xFF0000, tr);
paletteSetColor(0xB, 0x00FF00, tr);
paletteSetColor(0xC, 0xFFFF00, tr);
paletteSetColor(0xD, 0x0000FF, tr);
paletteSetColor(0xE, 0xFF00FF, tr);
paletteSetColor(0xF, 0x00FFFF, tr);
paletteSetColor(0x10, 0xFFFFFF, tr);
paletteSetColor(0x11, 0x000000, tr);
/* Google Material Colors */
paletteSetColor(0x01, 0x010101, tr); // what's this?
paletteSetColor(0x02, 0xFFFFFF, tr); // COL_WHITE
paletteSetColor(0x03, 0x000000, tr); // COL_BLACK
paletteSetColor(0x04, 0xb71c1c, tr); // COL_DARK_RED red 900
paletteSetColor(0x05, 0xf44336, tr); // COL_RED red 500
paletteSetColor(0x06, 0xe57373, tr); // COL_LIGHT_RED red 300
paletteSetColor(0x07, 0x1b5e20, tr); // COL_DARK_GREEN green 900
paletteSetColor(0x08, 0x4caf50, tr); // COL_GREEN green 500
paletteSetColor(0x09, 0x81c784, tr); // COL_LIGHT_GREEN green 300
paletteSetColor(0x0A, 0xf9a825, tr); // COL_DARK_YELLOW yellow 800
paletteSetColor(0x0B, 0xffeb3b, tr); // COL_YELLOW yellow 500
paletteSetColor(0x0C, 0xfff176, tr); // COL_LIGHT_YELLOW yellow 300
paletteSetColor(0x0D, 0x1a237e, tr); // COL_DARK_BLUE indigo 900
paletteSetColor(0x0E, 0x3f51b5, tr); // COL_BLUE indigo 500
paletteSetColor(0x0F, 0x7986cb, tr); // COL_LIGHT_BLUE indigo 300
paletteSetColor(0x10, 0x424242, tr); // COL_DARK_GRAY grey 800
paletteSetColor(0x11, 0x9e9e9e, tr); // COL_GRAY grey 500
paletteSetColor(0x12, 0xe0e0e0, tr); // COL_LIGHT_GRAY grey 300
paletteSetColor(COL_BACKGROUND, 0x000000, 0x0);
paletteSet();

View File

@@ -5,60 +5,61 @@
#ifdef FB_USE_PALETTE
/*
#define COL_WHITE (COLOR_CUSTOM + 0)
#define COL_RED (COLOR_CUSTOM + 1)
#define COL_GREEN (COLOR_CUSTOM + 2)
#define COL_BLUE (COLOR_CUSTOM + 3)
#define COL_YELLOW (COLOR_CUSTOM + 4)
#define COL_BLACK (COLOR_CUSTOM + 5)
*/
#define COL_DARK_RED 0x02
#define COL_DARK_GREEN 0x03
#define COL_OLIVE 0x04
#define COL_DARK_BLUE 0x05
#define COL_LIGHT_GRAY 0x08
#define COL_DARK_GRAY 0x09
#define COL_RED 0x0A
#define COL_GREEN 0x0B
#define COL_YELLOW 0x0C
#define COL_BLUE 0x0D
#define COL_PURP 0x0E
#define COL_LIGHT_BLUE 0x0F
#define COL_WHITE 0x10
#define COL_BLACK 0x11
#define COL_WHITE 0x02
#define COL_BLACK 0x03
#define COL_DARK_RED 0x04
#define COL_RED 0x05
#define COL_LIGHT_RED 0x06
#define COL_DARK_GREEN 0x07
#define COL_GREEN 0x08
#define COL_LIGHT_GREEN 0x09
#define COL_DARK_YELLOW 0x0A
#define COL_YELLOW 0x0B
#define COL_LIGHT_YELLOW 0x0C
#define COL_DARK_BLUE 0x0D
#define COL_BLUE 0x0E
#define COL_LIGHT_BLUE 0x0F
#define COL_DARK_GRAY 0x10
#define COL_GRAY 0x11
#define COL_LIGHT_GRAY 0x12
#else
#define COL_DARK_RED0 0x02
#define COL_DARK_GREEN0 0x03
#define COL_OLIVE0 0x04
#define COL_DARK_BLUE0 0x05
#define COL_LIGHT_GRAY0 0x08
#define COL_DARK_GRAY0 0x09
#define COL_RED0 0x0A
#define COL_GREEN0 0x0B
#define COL_YELLOW0 0x0C
#define COL_BLUE0 0x0D
#define COL_PURP0 0x0E
#define COL_LIGHT_BLUE0 0x0F
#define COL_WHITE0 0x10
#define COL_BLACK0 0x11
#define COL_WHITE0 0x02
#define COL_BLACK0 0x03
#define COL_DARK_RED0 0x04
#define COL_RED0 0x05
#define COL_LIGHT_RED0 0x06
#define COL_DARK_GREEN0 0x07
#define COL_GREEN0 0x08
#define COL_LIGHT_GREEN0 0x09
#define COL_DARK_YELLOW0 0x0A
#define COL_YELLOW0 0x0B
#define COL_LIGHT_YELLOW0 0x0C
#define COL_DARK_BLUE0 0x0D
#define COL_BLUE0 0x0E
#define COL_LIGHT_BLUE0 0x0F
#define COL_DARK_GRAY0 0x10
#define COL_GRAY0 0x11
#define COL_LIGHT_GRAY0 0x12
#define COL_DARK_RED (CFrameBuffer::getInstance()->realcolor[0x02])
#define COL_DARK_GREEN (CFrameBuffer::getInstance()->realcolor[0x03])
#define COL_OLIVE (CFrameBuffer::getInstance()->realcolor[0x04])
#define COL_DARK_BLUE (CFrameBuffer::getInstance()->realcolor[0x05])
#define COL_LIGHT_GRAY (CFrameBuffer::getInstance()->realcolor[0x08])
#define COL_DARK_GRAY (CFrameBuffer::getInstance()->realcolor[0x09])
#define COL_RED (CFrameBuffer::getInstance()->realcolor[0x0A])
#define COL_GREEN (CFrameBuffer::getInstance()->realcolor[0x0B])
#define COL_YELLOW (CFrameBuffer::getInstance()->realcolor[0x0C])
#define COL_BLUE (CFrameBuffer::getInstance()->realcolor[0x0D])
#define COL_PURP (CFrameBuffer::getInstance()->realcolor[0x0E])
#define COL_LIGHT_BLUE (CFrameBuffer::getInstance()->realcolor[0x0F])
#define COL_WHITE (CFrameBuffer::getInstance()->realcolor[0x10])
#define COL_BLACK (CFrameBuffer::getInstance()->realcolor[0x11])
#define COL_WHITE (CFrameBuffer::getInstance()->realcolor[0x02])
#define COL_BLACK (CFrameBuffer::getInstance()->realcolor[0x03])
#define COL_DARK_RED (CFrameBuffer::getInstance()->realcolor[0x04])
#define COL_RED (CFrameBuffer::getInstance()->realcolor[0x05])
#define COL_LIGHT_RED (CFrameBuffer::getInstance()->realcolor[0x06])
#define COL_DARK_GREEN (CFrameBuffer::getInstance()->realcolor[0x07])
#define COL_GREEN (CFrameBuffer::getInstance()->realcolor[0x08])
#define COL_LIGHT_GREEN (CFrameBuffer::getInstance()->realcolor[0x09])
#define COL_DARK_YELLOW (CFrameBuffer::getInstance()->realcolor[0x0A])
#define COL_YELLOW (CFrameBuffer::getInstance()->realcolor[0x0B])
#define COL_LIGHT_YELLOW (CFrameBuffer::getInstance()->realcolor[0x0C])
#define COL_DARK_BLUE (CFrameBuffer::getInstance()->realcolor[0x0D])
#define COL_BLUE (CFrameBuffer::getInstance()->realcolor[0x0E])
#define COL_LIGHT_BLUE (CFrameBuffer::getInstance()->realcolor[0x0F])
#define COL_DARK_GRAY (CFrameBuffer::getInstance()->realcolor[0x10])
#define COL_GRAY (CFrameBuffer::getInstance()->realcolor[0x11])
#define COL_LIGHT_GRAY (CFrameBuffer::getInstance()->realcolor[0x12])
#endif // FB_USE_PALETTE

View File

@@ -267,7 +267,7 @@ void CComponentsFooter::setButtonLabels(const struct button_label_cc * const con
if (icon_name == NEUTRINO_ICON_BUTTON_GREEN)
f_col = COL_DARK_GREEN;
if (icon_name == NEUTRINO_ICON_BUTTON_YELLOW)
f_col = COL_OLIVE;
f_col = COL_DARK_YELLOW;
if (icon_name == NEUTRINO_ICON_BUTTON_BLUE)
f_col = COL_DARK_BLUE;
btn->setColorFrame(f_col);

View File

@@ -168,6 +168,24 @@ static void set_lua_variables(lua_State *L)
/* list of colors, exported e.g. as COL['INFOBAR_SHADOW'] */
static table_key_u colorlist[] =
{
{ "COL_WHITE", MAGIC_COLOR | (COL_WHITE) },
{ "COL_BLACK", MAGIC_COLOR | (COL_BLACK) },
{ "COL_DARK_RED", MAGIC_COLOR | (COL_DARK_RED) },
{ "COL_RED", MAGIC_COLOR | (COL_RED) },
{ "COL_LIGHT_RED", MAGIC_COLOR | (COL_LIGHT_RED) },
{ "COL_DARK_GREEN", MAGIC_COLOR | (COL_DARK_GREEN) },
{ "COL_GREEN", MAGIC_COLOR | (COL_GREEN) },
{ "COL_LIGHT_GREEN", MAGIC_COLOR | (COL_LIGHT_GREEN) },
{ "COL_DARK_YELLOW", MAGIC_COLOR | (COL_DARK_YELLOW) },
{ "COL_YELLOW", MAGIC_COLOR | (COL_YELLOW) },
{ "COL_LIGHT_YELLOW", MAGIC_COLOR | (COL_LIGHT_YELLOW) },
{ "COL_DARK_BLUE", MAGIC_COLOR | (COL_DARK_BLUE) },
{ "COL_BLUE", MAGIC_COLOR | (COL_BLUE) },
{ "COL_LIGHT_BLUE", MAGIC_COLOR | (COL_LIGHT_BLUE) },
{ "COL_DARK_GRAY", MAGIC_COLOR | (COL_DARK_GRAY) },
{ "COL_GRAY", MAGIC_COLOR | (COL_GRAY) },
{ "COL_LIGHT_GRAY", MAGIC_COLOR | (COL_LIGHT_GRAY) },
{ "COLORED_EVENTS_CHANNELLIST", MAGIC_COLOR | (COL_COLORED_EVENTS_CHANNELLIST) },
{ "COLORED_EVENTS_INFOBAR", MAGIC_COLOR | (COL_COLORED_EVENTS_INFOBAR) },
{ "SHADOW", MAGIC_COLOR | (COL_SHADOW) },
@@ -186,28 +204,16 @@ static void set_lua_variables(lua_State *L)
{ "PROGRESSBAR_ACTIVE", MAGIC_COLOR | (COL_PROGRESSBAR_ACTIVE_PLUS_0) },
{ "PROGRESSBAR_PASSIVE", MAGIC_COLOR | (COL_PROGRESSBAR_PASSIVE_PLUS_0) },
{ "BACKGROUND", MAGIC_COLOR | (COL_BACKGROUND) },
{ "DARK_RED", MAGIC_COLOR | (COL_DARK_RED0) },
{ "DARK_GREEN", MAGIC_COLOR | (COL_DARK_GREEN0) },
{ "DARK_BLUE", MAGIC_COLOR | (COL_DARK_BLUE0) },
{ "LIGHT_GRAY", MAGIC_COLOR | (COL_LIGHT_GRAY0) },
{ "DARK_GRAY", MAGIC_COLOR | (COL_DARK_GRAY0) },
{ "RED", MAGIC_COLOR | (COL_RED0) },
{ "GREEN", MAGIC_COLOR | (COL_GREEN0) },
{ "YELLOW", MAGIC_COLOR | (COL_YELLOW0) },
{ "BLUE", MAGIC_COLOR | (COL_BLUE0) },
{ "PURP", MAGIC_COLOR | (COL_PURP0) },
{ "LIGHT_BLUE", MAGIC_COLOR | (COL_LIGHT_BLUE0) },
{ "WHITE", MAGIC_COLOR | (COL_WHITE0) },
{ "BLACK", MAGIC_COLOR | (COL_BLACK0) },
{ "COLORED_EVENTS_TEXT", (lua_Unsigned) (COL_COLORED_EVENTS_TEXT) },
{ "INFOBAR_TEXT", (lua_Unsigned) (COL_INFOBAR_TEXT) },
/* obsolete */ { "INFOBAR_SHADOW_TEXT", (lua_Unsigned) (COL_MENUFOOT_TEXT) }, // just here to stay backward compatible
{ "MENUHEAD_TEXT", (lua_Unsigned) (COL_MENUHEAD_TEXT) },
{ "MENUCONTENT_TEXT", (lua_Unsigned) (COL_MENUCONTENT_TEXT) },
{ "MENUCONTENT_TEXT_PLUS_1", (lua_Unsigned) (COL_MENUCONTENT_TEXT_PLUS_1) },
{ "MENUCONTENT_TEXT_PLUS_2", (lua_Unsigned) (COL_MENUCONTENT_TEXT_PLUS_2) },
{ "MENUCONTENT_TEXT_PLUS_3", (lua_Unsigned) (COL_MENUCONTENT_TEXT_PLUS_3) },
{ "MENUCONTENTDARK_TEXT", (lua_Unsigned) (COL_MENUCONTENTDARK_TEXT) },
{ "COLORED_EVENTS_TEXT", (lua_Unsigned) (COL_COLORED_EVENTS_TEXT) },
{ "INFOBAR_TEXT", (lua_Unsigned) (COL_INFOBAR_TEXT) },
/* obsolete */ { "INFOBAR_SHADOW_TEXT", (lua_Unsigned) (COL_MENUFOOT_TEXT) }, // just here to stay backward compatible
{ "MENUHEAD_TEXT", (lua_Unsigned) (COL_MENUHEAD_TEXT) },
{ "MENUCONTENT_TEXT", (lua_Unsigned) (COL_MENUCONTENT_TEXT) },
{ "MENUCONTENT_TEXT_PLUS_1", (lua_Unsigned) (COL_MENUCONTENT_TEXT_PLUS_1) },
{ "MENUCONTENT_TEXT_PLUS_2", (lua_Unsigned) (COL_MENUCONTENT_TEXT_PLUS_2) },
{ "MENUCONTENT_TEXT_PLUS_3", (lua_Unsigned) (COL_MENUCONTENT_TEXT_PLUS_3) },
{ "MENUCONTENTDARK_TEXT", (lua_Unsigned) (COL_MENUCONTENTDARK_TEXT) },
{ "MENUCONTENTDARK_TEXT_PLUS_1", (lua_Unsigned) (COL_MENUCONTENTDARK_TEXT_PLUS_1) },
{ "MENUCONTENTDARK_TEXT_PLUS_2", (lua_Unsigned) (COL_MENUCONTENTDARK_TEXT_PLUS_2) },
{ "MENUCONTENTSELECTED_TEXT", (lua_Unsigned) (COL_MENUCONTENTSELECTED_TEXT) },

View File

@@ -419,7 +419,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey)
}
else if (actionKey == "square"){
if (sq == NULL){
sq = new CComponentsShapeSquare (0, 0, 100, 100, NULL, CC_SHADOW_ON, COL_OLIVE, COL_LIGHT_GRAY, COL_RED);
sq = new CComponentsShapeSquare (0, 0, 100, 100, NULL, CC_SHADOW_ON, COL_DARK_YELLOW, COL_LIGHT_GRAY, COL_RED);
sq->enableFrame(true,1);
}
@@ -452,7 +452,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey)
}
else if (actionKey == "blink"){
if (sq == NULL)
sq = new CComponentsShapeSquare (0, 0, 100, 100, NULL, CC_SHADOW_ON, COL_OLIVE, COL_LIGHT_GRAY, COL_RED);
sq = new CComponentsShapeSquare (0, 0, 100, 100, NULL, CC_SHADOW_ON, COL_DARK_YELLOW, COL_LIGHT_GRAY, COL_RED);
sq->paintBlink(500);
sleep(10);