mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-31 09:21:09 +02:00
color: add getItemColors function to simplify color handling
Origin commit data
------------------
Commit: 56126c6a61
Author: vanhofen <vanhofen@gmx.de>
Date: 2016-10-19 (Wed, 19 Oct 2016)
Origin message was:
------------------
- color: add getItemColors function to simplify color handling
This commit is contained in:
@@ -228,3 +228,31 @@ void Rgb2Hsv(RgbColor *rgb, HsvColor *hsv)
|
||||
hsv->s = f_S;
|
||||
hsv->v = f_V;
|
||||
}
|
||||
|
||||
void getItemColors(fb_pixel_t &t, fb_pixel_t &b, bool selected, bool marked, bool switch_background)
|
||||
{
|
||||
if (selected && marked)
|
||||
{
|
||||
t = COL_MENUCONTENTSELECTED_TEXT_PLUS_2;
|
||||
b = COL_MENUCONTENTSELECTED_PLUS_2;
|
||||
return;
|
||||
}
|
||||
|
||||
if (selected)
|
||||
{
|
||||
t = COL_MENUCONTENTSELECTED_TEXT;
|
||||
b = COL_MENUCONTENTSELECTED_PLUS_0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (marked)
|
||||
{
|
||||
t = COL_MENUCONTENT_TEXT_PLUS_2;
|
||||
b = COL_MENUCONTENT_PLUS_2;
|
||||
return;
|
||||
}
|
||||
|
||||
// default
|
||||
t = COL_MENUCONTENT_TEXT;
|
||||
b = switch_background ? COL_MENUCONTENTDARK_PLUS_0 : COL_MENUCONTENT_PLUS_0;
|
||||
}
|
||||
|
@@ -161,4 +161,6 @@ uint8_t SysColor2Hsv(fb_pixel_t color, HsvColor *hsv);
|
||||
void Hsv2Rgb(HsvColor *hsv, RgbColor *rgb);
|
||||
void Rgb2Hsv(RgbColor *rgb, HsvColor *hsv);
|
||||
|
||||
void getItemColors(fb_pixel_t &t, fb_pixel_t &b, bool selected = false, bool marked = false, bool switch_background = false);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user