Dark mode

This commit is contained in:
GenevensiS
2025-10-09 17:57:20 +02:00
committed by GitHub
parent 78b93e5701
commit 513612cd0e
76 changed files with 323 additions and 144 deletions
+7 -1
View File
@@ -43,6 +43,10 @@ SCRIPT_FUNCTION(get_mse_locale) {
SCRIPT_RETURN(settings.locale);
}
SCRIPT_FUNCTION(get_mse_dark_mode) {
SCRIPT_RETURN(settings.darkMode());
}
SCRIPT_FUNCTION(trace) {
SCRIPT_PARAM_C(String, input);
#if defined(_DEBUG) && 0
@@ -866,10 +870,12 @@ SCRIPT_FUNCTION(rule) {
// ----------------------------------------------------------------------------- : Init
void init_script_basic_functions(Context& ctx) {
// debugging
// app info
ctx.setVariable(_("get_mse_version"), script_get_mse_version);
ctx.setVariable(_("get_mse_locale"), script_get_mse_locale);
ctx.setVariable(_("get_mse_path"), script_get_mse_path);
ctx.setVariable(_("get_mse_dark_mode"), script_get_mse_dark_mode);
// debugging
ctx.setVariable(_("trace"), script_trace);
ctx.setVariable(_("warning"), script_warning);
ctx.setVariable(_("error"), script_error);
+11
View File
@@ -193,6 +193,17 @@ void TokenIterator::readToken() {
addToken(TOK_STRING, include_file, pos);
addToken(TOK_RPAREN, ")", eol);
pos = eol;
} else if (is_substr(pos, end, "include dark file:")) {
pos += 18; // "include dark file:"
const char* newlines = "\r\n";
auto eol = find_first_of(pos, end, newlines, newlines + 2);
String include_file = trim(StringView(pos, eol)) + (settings.darkMode() ? _("_dark") : _(""));
// include_file("filename_dark")
addToken(TOK_NAME, "include_file", pos - 18);
addToken(TOK_LPAREN, "(", pos);
addToken(TOK_STRING, include_file, pos);
addToken(TOK_RPAREN, ")", eol);
pos = eol;
} else if (is_substr(pos, end, "include file:")) {
pos += 13; // "include file:"
const char* newlines = "\r\n";