Add experimental dark mode setting

This commit is contained in:
Willy-JL
2023-02-27 19:12:48 +00:00
parent 991d49733f
commit 007447cc61
7 changed files with 48 additions and 6 deletions
+13 -1
View File
@@ -6,6 +6,7 @@
#include <furi_hal.h>
#include <stdint.h>
#include <u8g2_glue.h>
#include <xtreme/settings.h>
const CanvasFontParameters canvas_font_params[FontTotalNumber] = {
[FontPrimary] = {.leading_default = 12, .leading_min = 11, .height = 8, .descender = 2},
@@ -105,11 +106,22 @@ CanvasFontParameters* canvas_get_font_params(Canvas* canvas, Font font) {
void canvas_clear(Canvas* canvas) {
furi_assert(canvas);
u8g2_ClearBuffer(&canvas->fb);
if(XTREME_SETTINGS()->dark_mode) {
u8g2_FillBuffer(&canvas->fb);
} else {
u8g2_ClearBuffer(&canvas->fb);
}
}
void canvas_set_color(Canvas* canvas, Color color) {
furi_assert(canvas);
if(XTREME_SETTINGS()->dark_mode) {
if(color == ColorBlack) {
color = ColorWhite;
} else if(color == ColorWhite) {
color = ColorBlack;
}
}
u8g2_SetDrawColor(&canvas->fb, color);
}
+2 -1
View File
@@ -39,8 +39,9 @@ void XTREME_SETTINGS_LOAD() {
xtreme_settings->bar_borders = true; // ON
xtreme_settings->bar_background = false; // OFF
xtreme_settings->bad_bt = false; // USB
xtreme_settings->sort_dirs_first = true; // ON
xtreme_settings->butthurt_timer = 43200; // 12 H
xtreme_settings->sort_dirs_first = true; // ON
xtreme_settings->dark_mode = false; // OFF
}
}
}
+3 -2
View File
@@ -11,7 +11,7 @@
#define MAX_PACK_NAME_LEN 32
#define XTREME_SETTINGS_VERSION (3)
#define XTREME_SETTINGS_VERSION (4)
#define XTREME_SETTINGS_PATH INT_PATH(XTREME_SETTINGS_FILE_NAME)
#define XTREME_SETTINGS_MAGIC (0x69)
@@ -28,8 +28,9 @@ typedef struct {
bool bar_borders;
bool bar_background;
bool bad_bt;
bool sort_dirs_first;
int32_t butthurt_timer;
bool sort_dirs_first;
bool dark_mode;
} XtremeSettings;
XtremeSettings* XTREME_SETTINGS();