#include "util.h" #include "theme.h" static const theme_t DEFAULT_THEME = { .text_styles = {{ .align = TEXT_ALIGN_TOP_CENTER, .pad = { 0, 10 }, .colors = { { 0xff, 0xff, 0xff, 0xff }, { 0x00, 0x00, 0x00, 0xff }, }, }, { .align = TEXT_ALIGN_BOTTOM_LEFT, .pad = { 10, 10 }, .colors = { { 0xff, 0xff, 0xff, 0xff }, { 0x00, 0x00, 0x00, 0xff }, }, }, { .align = TEXT_ALIGN_BOTTOM_RIGHT, .pad = { 10, 10 }, .colors = { { 0xff, 0xff, 0xff, 0xff }, { 0x00, 0x00, 0x00, 0xff }, }, }, { .align = TEXT_ALIGN_CENTER_CENTER, .pad = { 0, 0 }, .colors = { { 0xff, 0xff, 0xff, 0xff }, { 0x00, 0x00, 0x00, 0xff }, }, }, { .align = TEXT_ALIGN_TOP_RIGHT, .pad = { 10, 10 }, .colors = { { 0xff, 0xff, 0xff, 0xff }, { 0x00, 0x00, 0x00, 0xff }, }, }}, .bg_styles = {{ // normal style .r = { .base = 0x00 }, .g = { .base = 0x00 }, .b = { .base = 0x00 }, .a = { .base = 0xFF }, }, { // won style .r = { .base = 0x66, .scale = 0x33, .phase = 1000, .period = 2000 }, .g = { .base = 0x66, .scale = 0x33, .phase = 3000, .period = 5000 }, .b = { .base = 0x66, .scale = 0x33, .phase = 5000, .period = 7000 }, .a = { .base = 0xFF }, }}, }; const theme_t * theme_get_default(void) { return &DEFAULT_THEME; } const text_style_t * theme_get_text_style( const theme_t * const theme, const text_style_id_t id ) { if (id >= TEXT_STYLE_LAST) { die("invalid text style ID"); } return theme->text_styles + id; } const bg_style_t * theme_get_bg_style( const theme_t * const theme, const bg_style_id_t id ) { if (id >= BG_STYLE_LAST) { die("invalid BG style ID"); } return theme->bg_styles + id; }