forked from len0rd/rockbox
Give color targets the ability to display each LCD line a different color and use this newfangled ability to provide themable colored file types. See the comments on read_color_theme_file and the sample.colors file provided for how to use this. .colors files go in themes directory for now. This separate line color function should be trivial to add to menus and wpss.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13656 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
b57806237d
commit
74cbb0a1b2
15 changed files with 227 additions and 76 deletions
33
apps/misc.c
33
apps/misc.c
|
|
@ -984,3 +984,36 @@ void setvol(void)
|
|||
settings_save();
|
||||
}
|
||||
|
||||
#ifdef HAVE_LCD_COLOR
|
||||
/*
|
||||
* Helper function to convert a string of 6 hex digits to a native colour
|
||||
*/
|
||||
|
||||
#define hex2dec(c) (((c) >= '0' && ((c) <= '9')) ? (toupper(c)) - '0' : \
|
||||
(toupper(c)) - 'A' + 10)
|
||||
|
||||
int hex_to_rgb(const char* hex)
|
||||
{ int ok = 1;
|
||||
int i;
|
||||
int red, green, blue;
|
||||
|
||||
if (strlen(hex) == 6) {
|
||||
for (i=0; i < 6; i++ ) {
|
||||
if (!isxdigit(hex[i])) {
|
||||
ok=0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ok) {
|
||||
red = (hex2dec(hex[0]) << 4) | hex2dec(hex[1]);
|
||||
green = (hex2dec(hex[2]) << 4) | hex2dec(hex[3]);
|
||||
blue = (hex2dec(hex[4]) << 4) | hex2dec(hex[5]);
|
||||
return LCD_RGBPACK(red,green,blue);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* HAVE_LCD_COLOR */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue