I'm make Pebble Time versions of my watchfaces.
I want to be able to set a color variable that will hold a color depending on whether the Pebble Time is used or the Pebble OG is used.
I know you can do this:
#ifdef PBL_COLOR
window_set_background_color(s_main_window, GColorDukeBlue);
#else
window_set_background_color(s_main_window, GColorBlack);
#endif
But I don't want to apply this to the 50 different elements that I want to change the color to. Could I set a variable called myColor
at the start of my program at the start of my program and set it to GColorPastelYellow if it's using the Basalt hardware and set it to GColorWhite if it's the Aplite hardware?
I have this right now:
static GColor *myColor;
#ifdef PBL_COLOR
myColor = GColorPastelYellow;
#else
myColor = GColorWhite;
#endif
Unforuntately that doesn't work :/ Anyone have a solution to accomplishing this?
You were probably getting an error because window_set_background_color
expects a GColor
not a GColor *
, but you still can't make GColor
static. A great explanation is here.
You can however use #define
to your advantage. Like:
#ifdef PBL_COLOR
#define MYCOLOR GColorPastelYellow
#else
#define MYCOLOR GColorWhite
#endif