Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion workspace/all/bootlogo/bootlogo.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ int main(int argc, char *argv[])

PWR_setCPUSpeed(CPU_SPEED_MENU);

screen = GFX_init(MODE_MAIN);
screen = GFX_init(MODE_MENU);
PAD_init();
PWR_init();

Expand Down
2 changes: 1 addition & 1 deletion workspace/all/clock/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ enum {
int main(int argc , char* argv[]) {
PWR_setCPUSpeed(CPU_SPEED_MENU);

SDL_Surface* screen = GFX_init(MODE_MAIN);
SDL_Surface* screen = GFX_init(MODE_MENU);
PAD_init();
PWR_init();
InitSettings();
Expand Down
23 changes: 14 additions & 9 deletions workspace/all/common/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,14 +281,14 @@ int GFX_updateColors(void)
{
// We are currently micro managing all of these screen-mapped colors,
// should just move this to the caller.
THEME_COLOR1 = mapUint(CFG_getColor(1));
THEME_COLOR2 = mapUint(CFG_getColor(2));
THEME_COLOR3 = mapUint(CFG_getColor(3));
THEME_COLOR4 = mapUint(CFG_getColor(4));
THEME_COLOR5 = mapUint(CFG_getColor(5));
THEME_COLOR6 = mapUint(CFG_getColor(6));
THEME_COLOR7 = mapUint(CFG_getColor(7));
ALT_BUTTON_TEXT_COLOR = uintToColour(CFG_getColor(3));
THEME_COLOR1 = mapUint(CFG_getColor(COLOR_MAIN));
THEME_COLOR2 = mapUint(CFG_getColor(COLOR_ACCENT));
THEME_COLOR3 = mapUint(CFG_getColor(COLOR_ACCENT2));
THEME_COLOR4 = mapUint(CFG_getColor(COLOR_LIST_TEXT));
THEME_COLOR5 = mapUint(CFG_getColor(COLOR_LIST_TEXT_SELECTED));
THEME_COLOR6 = mapUint(CFG_getColor(COLOR_HINT));
THEME_COLOR7 = mapUint(CFG_getColor(COLOR_BACKGROUND));
ALT_BUTTON_TEXT_COLOR = uintToColour(CFG_getColor(COLOR_ACCENT2));

return 0;
}
Expand All @@ -308,6 +308,11 @@ SDL_Surface *GFX_init(int mode)

CFG_init(GFX_loadSystemFont, GFX_updateColors);

// by default, we will clear with whatever background color the user prefers
// if MODE_MENU /e.g. minarch, clear with default black)
if(mode == MODE_MAIN)
GFX_setClearColor(mapUint(CFG_getColor(COLOR_BACKGROUND)));

// We always have to symlink, does not depend on NTP being enabled
PLAT_initTimezones();
PLAT_setCurrentTimezone(PLAT_getCurrentTimezone());
Expand Down Expand Up @@ -1823,7 +1828,7 @@ void GFX_blitMessage(TTF_Font *font, char *msg, SDL_Surface *dst, SDL_Rect *dst_

if (len)
{
text = TTF_RenderUTF8_Blended_Wrapped(font, line, COLOR_WHITE, dst_rect->w);
text = TTF_RenderUTF8_Blended_Wrapped(font, line, uintToColour(CFG_getColor(COLOR_LIST_TEXT)), dst_rect->w);
int x = dst_rect->x;
x += (dst_rect->w - text->w) / 2;
SDL_BlitSurface(text, NULL, dst, &(SDL_Rect){x, y});
Expand Down
2 changes: 2 additions & 0 deletions workspace/all/common/api.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ SDL_Surface* GFX_init(int mode);
#define GFX_scrollTextTexture PLAT_scrollTextTexture // (TTF_Font* font, const char* in_name,int x, int y, int w, int h, SDL_Color color, float transparency, SDL_mutex* fontMutex);
#define GFX_flipHidden PLAT_flipHidden //(void)
#define GFX_GL_screenCapture PLAT_GL_screenCapture //(void)
#define GFX_setClearColor PLAT_setClearColor //(uint32_t color)

void GFX_setMode(int mode);
int GFX_hdmiChanged(void);
Expand Down Expand Up @@ -659,6 +660,7 @@ void PLAT_flip(SDL_Surface* screen, int sync);
void PLAT_GL_Swap();
void GFX_GL_Swap();
unsigned char* PLAT_GL_screenCapture(int* outWidth, int* outHeight);
void PLAT_setClearColor(uint32_t color);
void PLAT_GPU_Flip();
void PLAT_setShaders(int nr);
void PLAT_resetShaders();
Expand Down
28 changes: 14 additions & 14 deletions workspace/all/common/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -401,13 +401,13 @@ void CFG_init(FontLoad_callback_t cb, ColorSet_callback_t ccb)
}

// load gfx related stuff until we drop the indirection
CFG_setColor(1, CFG_getColor(1));
CFG_setColor(2, CFG_getColor(2));
CFG_setColor(3, CFG_getColor(3));
CFG_setColor(4, CFG_getColor(4));
CFG_setColor(5, CFG_getColor(5));
CFG_setColor(6, CFG_getColor(6));
CFG_setColor(7, CFG_getColor(7));
CFG_setColor(1, CFG_getColor(COLOR_MAIN));
CFG_setColor(2, CFG_getColor(COLOR_ACCENT));
CFG_setColor(3, CFG_getColor(COLOR_ACCENT2));
CFG_setColor(4, CFG_getColor(COLOR_LIST_TEXT));
CFG_setColor(5, CFG_getColor(COLOR_LIST_TEXT_SELECTED));
CFG_setColor(6, CFG_getColor(COLOR_HINT));
CFG_setColor(7, CFG_getColor(COLOR_BACKGROUND));
// avoid reloading the font if not neccessary
if (!fontLoaded)
CFG_setFontId(CFG_getFontId());
Expand Down Expand Up @@ -1024,31 +1024,31 @@ void CFG_get(const char *key, char *value)
}
else if (strcmp(key, "color1") == 0)
{
sprintf(value, "\"0x%06X\"", CFG_getColor(1));
sprintf(value, "\"0x%06X\"", CFG_getColor(COLOR_MAIN));
}
else if (strcmp(key, "color2") == 0)
{
sprintf(value, "\"0x%06X\"", CFG_getColor(2));
sprintf(value, "\"0x%06X\"", CFG_getColor(COLOR_ACCENT));
}
else if (strcmp(key, "color3") == 0)
{
sprintf(value, "\"0x%06X\"", CFG_getColor(3));
sprintf(value, "\"0x%06X\"", CFG_getColor(COLOR_ACCENT2));
}
else if (strcmp(key, "color4") == 0)
{
sprintf(value, "\"0x%06X\"", CFG_getColor(4));
sprintf(value, "\"0x%06X\"", CFG_getColor(COLOR_LIST_TEXT));
}
else if (strcmp(key, "color5") == 0)
{
sprintf(value, "\"0x%06X\"", CFG_getColor(5));
sprintf(value, "\"0x%06X\"", CFG_getColor(COLOR_LIST_TEXT_SELECTED));
}
else if (strcmp(key, "color6") == 0)
{
sprintf(value, "\"0x%06X\"", CFG_getColor(6));
sprintf(value, "\"0x%06X\"", CFG_getColor(COLOR_HINT));
}
else if (strcmp(key, "color7") == 0)
{
sprintf(value, "\"0x%06X\"", CFG_getColor(7));
sprintf(value, "\"0x%06X\"", CFG_getColor(COLOR_BACKGROUND));
}
else if (strcmp(key, "radius") == 0)
{
Expand Down
18 changes: 18 additions & 0 deletions workspace/all/common/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,17 @@ enum {
RA_SORT_COUNT
};

// Theme colors
enum {
COLOR_MAIN = 1,
COLOR_ACCENT = 2,
COLOR_ACCENT2 = 3,
COLOR_LIST_TEXT = 4,
COLOR_LIST_TEXT_SELECTED = 5,
COLOR_HINT = 6,
COLOR_BACKGROUND = 7
};

typedef struct
{
// Theme
Expand Down Expand Up @@ -161,6 +172,13 @@ typedef struct
#define CFG_DEFAULT_COLOR5 0x000000U
#define CFG_DEFAULT_COLOR6 0xffffffU
#define CFG_DEFAULT_COLOR7 0x000000U
#define CFG_DEFAULT_COLOR_MAIN CFG_DEFAULT_COLOR1
#define CFG_DEFAULT_COLOR_ACCENT CFG_DEFAULT_COLOR2
#define CFG_DEFAULT_COLOR_ACCENT2 CFG_DEFAULT_COLOR3
#define CFG_DEFAULT_COLOR_LIST_TEXT CFG_DEFAULT_COLOR4
#define CFG_DEFAULT_COLOR_LIST_TEXT_SELECTED CFG_DEFAULT_COLOR5
#define CFG_DEFAULT_COLOR_HINT CFG_DEFAULT_COLOR6
#define CFG_DEFAULT_COLOR_BACKGROUND CFG_DEFAULT_COLOR7
#define CFG_DEFAULT_THUMBRADIUS 20 // unscaled!
#define CFG_DEFAULT_SHOWCLOCK false
#define CFG_DEFAULT_CLOCK24H true
Expand Down
Loading