#include "theme.h"
#include <math.h>

Theme g_theme;

void theme_init_defaults(void) {
    g_theme.bg = DEFAULT_COL_BG;
    g_theme.text = DEFAULT_COL_TEXT;
    g_theme.cursor = DEFAULT_COL_CURSOR;
    g_theme.zoom = ZOOM_DEFAULT;
}

void theme_zoom_in(void) {
    g_theme.zoom += ZOOM_STEP;
    if (g_theme.zoom > ZOOM_MAX) g_theme.zoom = ZOOM_MAX;
}

void theme_zoom_out(void) {
    g_theme.zoom -= ZOOM_STEP;
    if (g_theme.zoom < ZOOM_MIN) g_theme.zoom = ZOOM_MIN;
}

void theme_zoom_reset(void) {
    g_theme.zoom = ZOOM_DEFAULT;
}

int theme_scaled_font_size(int baseSize) {
    int scaled = (int)roundf((float)baseSize * g_theme.zoom);
    return scaled < 6 ? 6 : scaled;
}
