feat: begin adding settings menu, move theme to settings
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
#include "Utility.h"
|
||||
#include <beaker.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user