From c3ed9017385342944badec46de263560c6ab07c8 Mon Sep 17 00:00:00 2001 From: frosty Date: Mon, 30 Mar 2026 10:37:46 +0300 Subject: feat: begin adding settings menu, move theme to settings --- src/Utility/Utility.c | 14 ++++++++++++++ src/Utility/Utility.h | 1 + 2 files changed, 15 insertions(+) (limited to 'src/Utility') diff --git a/src/Utility/Utility.c b/src/Utility/Utility.c index 3be4ef4..b4ad91d 100644 --- a/src/Utility/Utility.c +++ b/src/Utility/Utility.c @@ -1,4 +1,7 @@ #include "Utility.h" +#include +#include +#include int hex_to_int(char c) { if (c >= '0' && c <= '9') @@ -9,3 +12,14 @@ int hex_to_int(char c) { return c - 'A' + 10; return -1; } + +char *get_theme(const char *default_theme) { + char *cookie = get_cookie("theme"); + if (cookie && + (strcmp(cookie, "light") == 0 || + strcmp(cookie, "dark") == 0)) { + return cookie; + } + free(cookie); + return strdup(default_theme); +} diff --git a/src/Utility/Utility.h b/src/Utility/Utility.h index 3b0181c..e67282f 100644 --- a/src/Utility/Utility.h +++ b/src/Utility/Utility.h @@ -2,5 +2,6 @@ #define UTILITY_H int hex_to_int(char c); +char *get_theme(const char *default_theme); #endif -- cgit v1.2.3