diff options
Diffstat (limited to 'src/saffron_text.c')
| -rw-r--r-- | src/saffron_text.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/saffron_text.c b/src/saffron_text.c index 6e7accf..3beb219 100644 --- a/src/saffron_text.c +++ b/src/saffron_text.c @@ -13,7 +13,12 @@ static void saffron_text_draw(SaffronWidget* widget, SDL_Renderer* renderer) { SaffronText* text = (SaffronText*)widget; if (!text->text || !text->font) return; - SDL_Surface* surface = TTF_RenderText_Blended(text->font, text->text, 0, text->color); + SaffronTheme* theme = ((SaffronWidget*)text)->theme; + if (!theme) return; + + SaffronColor text_color = theme->primary; + SDL_Color color = {text_color.r, text_color.g, text_color.b, text_color.a}; + SDL_Surface* surface = TTF_RenderText_Blended(text->font, text->text, 0, color); if (!surface) return; SDL_Texture* texture = SDL_CreateTextureFromSurface(renderer, surface); @@ -24,7 +29,7 @@ static void saffron_text_draw(SaffronWidget* widget, SDL_Renderer* renderer) { SDL_DestroySurface(surface); } -SaffronText* saffron_text_new(const char* text, TTF_Font* font, SDL_Color color) { +SaffronText* saffron_text_new(const char* text, TTF_Font* font) { SaffronText* text_widget = malloc(sizeof(SaffronText)); if (!text_widget) return NULL; @@ -47,7 +52,6 @@ SaffronText* saffron_text_new(const char* text, TTF_Font* font, SDL_Color color) strcpy(text_widget->text, text); } text_widget->font = font; - text_widget->color = color; return text_widget; } |
