nyx: lvgl: complete black theme and add options

Since, this has the side-effect to make any theme color component from 0x0B to 0xC7
work, add theme background controls in Nyx Options.
Additionally, set shadow color to black and fix inactive buttons on transparent styles.
This commit is contained in:
CTCaer
2026-02-12 05:59:16 +02:00
parent 5cca9025b0
commit 6c820067a7
8 changed files with 372 additions and 119 deletions

View File

@@ -45,7 +45,7 @@ typedef struct _hekate_config
typedef struct _nyx_config typedef struct _nyx_config
{ {
u32 theme_bg; u32 theme_bg; // COLOR_BG_BASE_MIN - COLOR_BG_BASE_MAX.
u32 theme_color; u32 theme_color;
u32 entries_5_col; u32 entries_5_col;
u32 timeoffset; u32 timeoffset;

View File

@@ -33,8 +33,6 @@
#define OUT_FILENAME_SZ 128 #define OUT_FILENAME_SZ 128
#define NUM_SECTORS_PER_ITER 8192 // 4MB Cache. #define NUM_SECTORS_PER_ITER 8192 // 4MB Cache.
extern volatile boot_cfg_t *b_cfg;
void load_emummc_cfg(emummc_cfg_t *emu_info) void load_emummc_cfg(emummc_cfg_t *emu_info)
{ {
memset(emu_info, 0, sizeof(emummc_cfg_t)); memset(emu_info, 0, sizeof(emummc_cfg_t));

View File

@@ -52,7 +52,7 @@ lv_img_dsc_t *icon_lakka;
lv_img_dsc_t *hekate_bg; lv_img_dsc_t *hekate_bg;
lv_style_t btn_transp_rel, btn_transp_pr, btn_transp_tgl_rel, btn_transp_tgl_pr; lv_style_t btn_transp_rel, btn_transp_pr, btn_transp_tgl_rel, btn_transp_tgl_pr, btn_transp_ina;
lv_style_t ddlist_transp_bg, ddlist_transp_sel; lv_style_t ddlist_transp_bg, ddlist_transp_sel;
lv_style_t tabview_btn_pr, tabview_btn_tgl_pr; lv_style_t tabview_btn_pr, tabview_btn_tgl_pr;
@@ -701,7 +701,7 @@ lv_img_dsc_t *bmp_to_lvimg_obj(const char *path)
} }
lv_img_dsc_t *img_desc = (lv_img_dsc_t *)bitmap; lv_img_dsc_t *img_desc = (lv_img_dsc_t *)bitmap;
u32 offset_copy = ALIGN((u32)bitmap + sizeof(lv_img_dsc_t), 0x10); uptr offset_copy = ALIGN((uptr)bitmap + sizeof(lv_img_dsc_t), 0x10);
img_desc->header.always_zero = 0; img_desc->header.always_zero = 0;
img_desc->header.w = bmpData.size_x; img_desc->header.w = bmpData.size_x;
@@ -1220,7 +1220,7 @@ void nyx_create_onoff_button(lv_theme_t *th, lv_obj_t *parent, lv_obj_t *btn, co
btn_onoff_pr_hos_style.body.opa = 35; btn_onoff_pr_hos_style.body.opa = 35;
} }
else else
btn_onoff_pr_hos_style.body.main_color = LV_COLOR_HEX(theme_bg_color ? (theme_bg_color + 0x101010) : 0x2D2D2D); btn_onoff_pr_hos_style.body.main_color = LV_COLOR_HEX(theme_bg_color ? (theme_bg_color + 0x101010) : 0x2D2D2D); // COLOR_HOS_BG_LIGHT.
btn_onoff_pr_hos_style.body.grad_color = btn_onoff_pr_hos_style.body.main_color; btn_onoff_pr_hos_style.body.grad_color = btn_onoff_pr_hos_style.body.main_color;
btn_onoff_pr_hos_style.text.color = th->btn.pr->text.color; btn_onoff_pr_hos_style.text.color = th->btn.pr->text.color;
btn_onoff_pr_hos_style.body.empty = 0; btn_onoff_pr_hos_style.body.empty = 0;
@@ -1270,7 +1270,7 @@ static void _create_text_button(lv_theme_t *th, lv_obj_t *parent, lv_obj_t *btn,
btn_onoff_pr_hos_style.body.opa = 35; btn_onoff_pr_hos_style.body.opa = 35;
} }
else else
btn_onoff_pr_hos_style.body.main_color = LV_COLOR_HEX(theme_bg_color ? (theme_bg_color + 0x101010) : 0x2D2D2D); btn_onoff_pr_hos_style.body.main_color = LV_COLOR_HEX(theme_bg_color ? (theme_bg_color + 0x101010) : 0x2D2D2D); // COLOR_HOS_BG_LIGHT
btn_onoff_pr_hos_style.body.grad_color = btn_onoff_pr_hos_style.body.main_color; btn_onoff_pr_hos_style.body.grad_color = btn_onoff_pr_hos_style.body.main_color;
btn_onoff_pr_hos_style.text.color = th->btn.pr->text.color; btn_onoff_pr_hos_style.text.color = th->btn.pr->text.color;
btn_onoff_pr_hos_style.body.empty = 0; btn_onoff_pr_hos_style.body.empty = 0;
@@ -1720,7 +1720,7 @@ static lv_res_t _create_window_home_launch(lv_obj_t *btn)
lv_obj_t *boot_entry_label; lv_obj_t *boot_entry_label;
bool no_boot_entries = false; bool no_boot_entries = false;
// Create CFW buttons. // Create Boot Entry buttons.
// Buttons are 200 x 200 with 4 pixel borders. // Buttons are 200 x 200 with 4 pixel borders.
// Icons must be <= 192 x 192. // Icons must be <= 192 x 192.
// Create first Button. // Create first Button.
@@ -1915,11 +1915,20 @@ ini_parsing:
btn_height = 200; btn_height = 200;
lv_btn_set_style(launch_ctxt.btn[curr_btn_idx], LV_BTN_STYLE_REL, &btn_home_noborder_rel); lv_btn_set_style(launch_ctxt.btn[curr_btn_idx], LV_BTN_STYLE_REL, &btn_home_noborder_rel);
lv_btn_set_style(launch_ctxt.btn[curr_btn_idx], LV_BTN_STYLE_PR, &btn_home_noborder_rel); lv_btn_set_style(launch_ctxt.btn[curr_btn_idx], LV_BTN_STYLE_PR, &btn_home_noborder_rel);
} }
lv_obj_set_size(btns, btn_width, btn_height); lv_obj_set_size(btns, btn_width, btn_height);
lv_btn_set_style(btns, LV_BTN_STYLE_REL, img_noborder ? &btn_home_noborder_rel : &btn_home_transp_rel); lv_btn_set_style(btns, LV_BTN_STYLE_REL, img_noborder ? &btn_home_noborder_rel : &btn_home_transp_rel);
lv_btn_set_style(btns, LV_BTN_STYLE_PR, &btn_home_transp_pr); lv_btn_set_style(btns, LV_BTN_STYLE_PR, &btn_home_transp_pr);
// Button transparency if custom background, but loses color.
// if (!btn && hekate_bg && !img_noborder)
// {
// lv_btn_set_style(launch_ctxt.btn[curr_btn_idx], LV_BTN_STYLE_REL, &btn_transp_rel);
// lv_btn_set_style(launch_ctxt.btn[curr_btn_idx], LV_BTN_STYLE_PR, &btn_transp_pr);
// lv_btn_set_style(btns, LV_BTN_STYLE_REL, &btn_home_noborder_rel);
// }
if (img) if (img)
lv_obj_align(img, NULL, LV_ALIGN_CENTER, 0, 0); lv_obj_align(img, NULL, LV_ALIGN_CENTER, 0, 0);
if (img_noborder) if (img_noborder)
@@ -2063,6 +2072,12 @@ static void _create_tab_home(lv_theme_t *th, lv_obj_t *parent)
// lv_obj_set_width(btn_quick_launch, 256); // lv_obj_set_width(btn_quick_launch, 256);
// lv_obj_set_pos(btn_quick_launch, 343, 448); // lv_obj_set_pos(btn_quick_launch, 343, 448);
// lv_btn_set_action(btn_quick_launch, LV_BTN_ACTION_CLICK, NULL); // lv_btn_set_action(btn_quick_launch, LV_BTN_ACTION_CLICK, NULL);
// if (hekate_bg)
// {
// lv_btn_set_style(btn_quick_launch, LV_BTN_STYLE_REL, &btn_transp_rel);
// lv_btn_set_style(btn_quick_launch, LV_BTN_STYLE_PR, &btn_transp_pr);
// lv_btn_set_style(btn_quick_launch, LV_BTN_STYLE_INA, &btn_transp_ina);
// }
lv_obj_t *btn_nyx_options = lv_btn_create(parent, NULL); lv_obj_t *btn_nyx_options = lv_btn_create(parent, NULL);
_create_text_button(th, NULL, btn_nyx_options, SYMBOL_SETTINGS" Nyx Settings", NULL); _create_text_button(th, NULL, btn_nyx_options, SYMBOL_SETTINGS" Nyx Settings", NULL);
@@ -2280,9 +2295,9 @@ static void _nyx_set_default_styles(lv_theme_t * th)
hint_small_style_white.text.font = &interui_20; hint_small_style_white.text.font = &interui_20;
lv_style_copy(&monospace_text, &lv_style_plain); lv_style_copy(&monospace_text, &lv_style_plain);
monospace_text.body.main_color = LV_COLOR_HEX(0x1B1B1B); monospace_text.body.main_color = COLOR_HOS_BG_DARKER;
monospace_text.body.grad_color = LV_COLOR_HEX(0x1B1B1B); monospace_text.body.grad_color = COLOR_HOS_BG_DARKER;
monospace_text.body.border.color = LV_COLOR_HEX(0x1B1B1B); monospace_text.body.border.color = COLOR_HOS_BG_DARKER;
monospace_text.body.border.width = 0; monospace_text.body.border.width = 0;
monospace_text.body.opa = LV_OPA_TRANSP; monospace_text.body.opa = LV_OPA_TRANSP;
monospace_text.text.color = LV_COLOR_HEX(0xD8D8D8); monospace_text.text.color = LV_COLOR_HEX(0xD8D8D8);
@@ -2293,42 +2308,53 @@ static void _nyx_set_default_styles(lv_theme_t * th)
lv_style_copy(&btn_transp_rel, th->btn.rel); lv_style_copy(&btn_transp_rel, th->btn.rel);
btn_transp_rel.body.main_color = LV_COLOR_HEX(0x444444); btn_transp_rel.body.main_color = LV_COLOR_HEX(0x444444);
btn_transp_rel.body.grad_color = btn_transp_rel.body.main_color; btn_transp_rel.body.grad_color = btn_transp_rel.body.main_color;
btn_transp_rel.body.shadow.color = LV_COLOR_HEX(0x0F0F0F);
btn_transp_rel.body.opa = LV_OPA_50; btn_transp_rel.body.opa = LV_OPA_50;
lv_style_copy(&btn_transp_pr, th->btn.pr); lv_style_copy(&btn_transp_pr, th->btn.pr);
btn_transp_pr.body.main_color = LV_COLOR_HEX(0x888888); btn_transp_pr.body.main_color = LV_COLOR_HEX(0x888888);
btn_transp_pr.body.grad_color = btn_transp_pr.body.main_color; btn_transp_pr.body.grad_color = btn_transp_pr.body.main_color;
btn_transp_pr.body.shadow.color = LV_COLOR_HEX(0x0F0F0F);
btn_transp_pr.body.opa = LV_OPA_50; btn_transp_pr.body.opa = LV_OPA_50;
lv_style_copy(&btn_transp_tgl_rel, th->btn.tgl_rel); lv_style_copy(&btn_transp_tgl_rel, th->btn.tgl_rel);
btn_transp_tgl_rel.body.main_color = LV_COLOR_HEX(0x444444); btn_transp_tgl_rel.body.main_color = LV_COLOR_HEX(0x444444);
btn_transp_tgl_rel.body.grad_color = btn_transp_tgl_rel.body.main_color; btn_transp_tgl_rel.body.grad_color = btn_transp_tgl_rel.body.main_color;
btn_transp_tgl_rel.body.shadow.color = LV_COLOR_HEX(0x0F0F0F);
btn_transp_tgl_rel.body.opa = LV_OPA_50; btn_transp_tgl_rel.body.opa = LV_OPA_50;
lv_style_copy(&btn_transp_tgl_pr, th->btn.tgl_pr); lv_style_copy(&btn_transp_tgl_pr, th->btn.tgl_pr);
btn_transp_tgl_pr.body.main_color = LV_COLOR_HEX(0x888888); btn_transp_tgl_pr.body.main_color = LV_COLOR_HEX(0x888888);
btn_transp_tgl_pr.body.grad_color = btn_transp_tgl_pr.body.main_color; btn_transp_tgl_pr.body.grad_color = btn_transp_tgl_pr.body.main_color;
btn_transp_tgl_pr.body.shadow.color = LV_COLOR_HEX(0x0F0F0F);
btn_transp_tgl_pr.body.opa = LV_OPA_50; btn_transp_tgl_pr.body.opa = LV_OPA_50;
lv_style_copy(&btn_transp_ina, th->btn.ina);
btn_transp_ina.body.main_color = LV_COLOR_HEX(0x292929);
btn_transp_ina.body.grad_color = btn_transp_ina.body.main_color;
btn_transp_ina.body.border.color = LV_COLOR_HEX(0x444444);
btn_transp_ina.body.shadow.color = LV_COLOR_HEX(0x0F0F0F);
btn_transp_ina.body.opa = LV_OPA_50;
lv_style_copy(&ddlist_transp_bg, th->ddlist.bg); lv_style_copy(&ddlist_transp_bg, th->ddlist.bg);
ddlist_transp_bg.body.main_color = LV_COLOR_HEX(0x2D2D2D); ddlist_transp_bg.body.main_color = LV_COLOR_HEX(0x2D2D2D);
ddlist_transp_bg.body.grad_color = ddlist_transp_bg.body.main_color; ddlist_transp_bg.body.grad_color = ddlist_transp_bg.body.main_color;
ddlist_transp_bg.body.opa = 180; ddlist_transp_bg.body.opa = 180; // 70.6%.
lv_style_copy(&ddlist_transp_sel, th->ddlist.sel); lv_style_copy(&ddlist_transp_sel, th->ddlist.sel);
ddlist_transp_sel.body.main_color = LV_COLOR_HEX(0x4D4D4D); ddlist_transp_sel.body.main_color = LV_COLOR_HEX(0x4D4D4D);
ddlist_transp_sel.body.grad_color = ddlist_transp_sel.body.main_color; ddlist_transp_sel.body.grad_color = ddlist_transp_sel.body.main_color;
ddlist_transp_sel.body.opa = 180; ddlist_transp_sel.body.opa = 180; // 70.6%.
lv_style_copy(&tabview_btn_pr, th->tabview.btn.pr); lv_style_copy(&tabview_btn_pr, th->tabview.btn.pr);
tabview_btn_pr.body.main_color = LV_COLOR_HEX(0xFFFFFF); tabview_btn_pr.body.main_color = LV_COLOR_HEX(0xFFFFFF);
tabview_btn_pr.body.grad_color = tabview_btn_pr.body.main_color; tabview_btn_pr.body.grad_color = tabview_btn_pr.body.main_color;
tabview_btn_pr.body.opa = 35; tabview_btn_pr.body.opa = 35; // 13.7%.
lv_style_copy(&tabview_btn_tgl_pr, th->tabview.btn.tgl_pr); lv_style_copy(&tabview_btn_tgl_pr, th->tabview.btn.tgl_pr);
tabview_btn_tgl_pr.body.main_color = LV_COLOR_HEX(0xFFFFFF); tabview_btn_tgl_pr.body.main_color = LV_COLOR_HEX(0xFFFFFF);
tabview_btn_tgl_pr.body.grad_color = tabview_btn_tgl_pr.body.main_color; tabview_btn_tgl_pr.body.grad_color = tabview_btn_tgl_pr.body.main_color;
tabview_btn_tgl_pr.body.opa = 35; tabview_btn_tgl_pr.body.opa = 35; // 13.7%.
lv_color_t tmp_color = lv_color_hsv_to_rgb(n_cfg.theme_color, 100, 100); lv_color_t tmp_color = lv_color_hsv_to_rgb(n_cfg.theme_color, 100, 100);
text_color = malloc(32); text_color = malloc(32);

View File

@@ -62,7 +62,7 @@ extern lv_img_dsc_t *icon_lakka;
extern lv_img_dsc_t *hekate_bg; extern lv_img_dsc_t *hekate_bg;
extern lv_style_t btn_transp_rel, btn_transp_pr, btn_transp_tgl_rel, btn_transp_tgl_pr; extern lv_style_t btn_transp_rel, btn_transp_pr, btn_transp_tgl_rel, btn_transp_tgl_pr, btn_transp_ina;
extern lv_style_t ddlist_transp_bg, ddlist_transp_sel; extern lv_style_t ddlist_transp_bg, ddlist_transp_sel;
extern lv_style_t tabview_btn_pr, tabview_btn_tgl_pr; extern lv_style_t tabview_btn_pr, tabview_btn_tgl_pr;
@@ -72,7 +72,7 @@ extern char *text_color;
extern gui_status_bar_ctx status_bar; extern gui_status_bar_ctx status_bar;
void reload_nyx(); void reload_nyx(lv_obj_t *obj, bool force);
lv_img_dsc_t *bmp_to_lvimg_obj(const char *path); lv_img_dsc_t *bmp_to_lvimg_obj(const char *path);
bool nyx_emmc_check_battery_enough(); bool nyx_emmc_check_battery_enough();
lv_res_t nyx_mbox_action(lv_obj_t * btns, const char * txt); lv_res_t nyx_mbox_action(lv_obj_t * btns, const char * txt);

View File

@@ -28,8 +28,6 @@
#include "../hos/hos.h" #include "../hos/hos.h"
#include <libs/fatfs/ff.h> #include <libs/fatfs/ff.h>
extern boot_cfg_t b_cfg;
extern char *emmcsn_path_impl(char *path, char *sub_dir, char *filename, sdmmc_storage_t *storage); extern char *emmcsn_path_impl(char *path, char *sub_dir, char *filename, sdmmc_storage_t *storage);
typedef struct _emmc_backup_buttons_t typedef struct _emmc_backup_buttons_t

View File

@@ -30,7 +30,6 @@
static const char base36[37] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; static const char base36[37] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
extern volatile boot_cfg_t *b_cfg;
extern volatile nyx_storage_t *nyx_str; extern volatile nyx_storage_t *nyx_str;
extern lv_res_t launch_payload(lv_obj_t *list); extern lv_res_t launch_payload(lv_obj_t *list);
@@ -2948,7 +2947,8 @@ void create_tab_info(lv_theme_t *th, lv_obj_t *parent)
if (hekate_bg) if (hekate_bg)
{ {
lv_btn_set_style(btn, LV_BTN_STYLE_REL, &btn_transp_rel); lv_btn_set_style(btn, LV_BTN_STYLE_REL, &btn_transp_rel);
lv_btn_set_style(btn, LV_BTN_STYLE_PR, &btn_transp_pr); lv_btn_set_style(btn, LV_BTN_STYLE_PR, &btn_transp_pr);
lv_btn_set_style(btn, LV_BTN_STYLE_INA, &btn_transp_ina);
} }
lv_obj_t *label_btn = lv_label_create(btn, NULL); lv_obj_t *label_btn = lv_label_create(btn, NULL);
lv_btn_set_fit(btn, true, true); lv_btn_set_fit(btn, true, true);
@@ -2988,13 +2988,13 @@ void create_tab_info(lv_theme_t *th, lv_obj_t *parent)
static lv_style_t line_style; static lv_style_t line_style;
lv_style_copy(&line_style, th->line.decor); lv_style_copy(&line_style, th->line.decor);
line_style.line.color = LV_COLOR_HEX(0x444444); line_style.line.color = LV_COLOR_HEX(theme_bg_color ? (theme_bg_color + 0x171717) : 0x343434);
line_sep = lv_line_create(h1, line_sep); line_sep = lv_line_create(h1, line_sep);
lv_obj_align(line_sep, label_txt2, LV_ALIGN_OUT_BOTTOM_LEFT, -(LV_DPI / 4), LV_DPI / 16); lv_obj_align(line_sep, label_txt2, LV_ALIGN_OUT_BOTTOM_LEFT, -(LV_DPI / 4), LV_DPI / 16);
lv_line_set_style(line_sep, &line_style); lv_line_set_style(line_sep, &line_style);
// Create Fuses button. // Create HW info button.
lv_obj_t *btn3 = lv_btn_create(h1, btn); lv_obj_t *btn3 = lv_btn_create(h1, btn);
label_btn = lv_label_create(btn3, NULL); label_btn = lv_label_create(btn3, NULL);
lv_btn_set_fit(btn3, true, true); lv_btn_set_fit(btn3, true, true);

View File

@@ -376,25 +376,26 @@ static lv_res_t _save_nyx_options_action(lv_obj_t *btn)
void create_flat_button(lv_obj_t *parent, lv_obj_t *btn, lv_color_t color, lv_action_t action) void create_flat_button(lv_obj_t *parent, lv_obj_t *btn, lv_color_t color, lv_action_t action)
{ {
lv_style_t *btn_onoff_rel_hos_style = malloc(sizeof(lv_style_t)); lv_style_t *btn_onoff_rel_hos_style = malloc(sizeof(lv_style_t));
lv_style_t *btn_onoff_pr_hos_style = malloc(sizeof(lv_style_t)); lv_style_t *btn_onoff_pr_hos_style = malloc(sizeof(lv_style_t));
lv_style_copy(btn_onoff_rel_hos_style, lv_theme_get_current()->btn.rel); lv_style_copy(btn_onoff_rel_hos_style, lv_theme_get_current()->btn.rel);
btn_onoff_rel_hos_style->body.main_color = color; btn_onoff_rel_hos_style->body.main_color = color;
btn_onoff_rel_hos_style->body.grad_color = btn_onoff_rel_hos_style->body.main_color; btn_onoff_rel_hos_style->body.grad_color = btn_onoff_rel_hos_style->body.main_color;
btn_onoff_rel_hos_style->body.padding.hor = 0; btn_onoff_rel_hos_style->body.padding.hor = 0;
btn_onoff_rel_hos_style->body.radius = 0; btn_onoff_rel_hos_style->body.radius = 0;
lv_style_copy(btn_onoff_pr_hos_style, lv_theme_get_current()->btn.pr); lv_style_copy(btn_onoff_pr_hos_style, lv_theme_get_current()->btn.pr);
btn_onoff_pr_hos_style->body.main_color = color; btn_onoff_pr_hos_style->body.main_color = color;
btn_onoff_pr_hos_style->body.grad_color = btn_onoff_pr_hos_style->body.main_color; btn_onoff_pr_hos_style->body.grad_color = btn_onoff_pr_hos_style->body.main_color;
btn_onoff_pr_hos_style->body.padding.hor = 0; btn_onoff_pr_hos_style->body.padding.hor = 0;
btn_onoff_pr_hos_style->body.border.color = LV_COLOR_GRAY; btn_onoff_pr_hos_style->body.border.color = LV_COLOR_HEX(0xFFFFFF);
btn_onoff_pr_hos_style->body.border.opa = LV_OPA_50;
btn_onoff_pr_hos_style->body.border.width = 4; btn_onoff_pr_hos_style->body.border.width = 4;
btn_onoff_pr_hos_style->body.radius = 0; btn_onoff_pr_hos_style->body.radius = 0;
lv_btn_set_style(btn, LV_BTN_STYLE_REL, btn_onoff_rel_hos_style); lv_btn_set_style(btn, LV_BTN_STYLE_REL, btn_onoff_rel_hos_style);
lv_btn_set_style(btn, LV_BTN_STYLE_PR, btn_onoff_pr_hos_style); lv_btn_set_style(btn, LV_BTN_STYLE_PR, btn_onoff_pr_hos_style);
lv_btn_set_style(btn, LV_BTN_STYLE_TGL_REL, btn_onoff_rel_hos_style); lv_btn_set_style(btn, LV_BTN_STYLE_TGL_REL, btn_onoff_rel_hos_style);
lv_btn_set_style(btn, LV_BTN_STYLE_TGL_PR, btn_onoff_pr_hos_style); lv_btn_set_style(btn, LV_BTN_STYLE_TGL_PR, btn_onoff_pr_hos_style);
lv_btn_set_fit(btn, false, true); lv_btn_set_fit(btn, false, true);
lv_obj_set_width(btn, lv_obj_get_height(btn)); lv_obj_set_width(btn, lv_obj_get_height(btn));
@@ -408,6 +409,10 @@ typedef struct _color_test_ctxt
{ {
u32 bg; u32 bg;
u16 hue; u16 hue;
u8 r;
u8 g;
u8 b;
lv_obj_t *window; lv_obj_t *window;
lv_obj_t *header1; lv_obj_t *header1;
lv_obj_t *header2; lv_obj_t *header2;
@@ -417,11 +422,25 @@ typedef struct _color_test_ctxt
lv_obj_t *button; lv_obj_t *button;
lv_obj_t *hue_slider; lv_obj_t *hue_slider;
lv_obj_t *hue_label; lv_obj_t *hue_label;
lv_obj_t *r_slider;
lv_obj_t *r_label;
lv_obj_t *g_slider;
lv_obj_t *g_label;
lv_obj_t *b_slider;
lv_obj_t *b_label;
lv_style_t box_style;
lv_obj_t *box;
lv_obj_t *btn_apply;
lv_obj_t *btn_black;
lv_obj_t *btn_reset;
} color_test_ctxt; } color_test_ctxt;
color_test_ctxt color_test; color_test_ctxt color_test;
static lv_res_t _save_theme_color_action(lv_obj_t *btn) static lv_res_t _action_win_nyx_colors_save(lv_obj_t *btn)
{ {
n_cfg.theme_bg = color_test.bg; n_cfg.theme_bg = color_test.bg;
n_cfg.theme_color = color_test.hue; n_cfg.theme_color = color_test.hue;
@@ -434,12 +453,23 @@ static lv_res_t _save_theme_color_action(lv_obj_t *btn)
return LV_RES_OK; return LV_RES_OK;
} }
static void _show_new_nyx_color(u32 bg, u16 hue, bool update_bg) static void _show_new_nyx_color(bool update_bg)
{ {
lv_color_t bgc = LV_COLOR_HEX(bg); u32 bg = color_test.bg;
lv_color_t bgc_light = LV_COLOR_HEX(bg ? (bg + 0x101010) : 0x2D2D2D); u16 hue = color_test.hue;
lv_color_t bg_border = LV_COLOR_HEX(bg ? (bg + 0x202020) : 0x3D3D3D);
lv_color_t color = lv_color_hsv_to_rgb(hue, 100, 100); lv_color_t bgc = LV_COLOR_HEX(bg); // COLOR_HOS_BG.
lv_color_t bgc_light = LV_COLOR_HEX(bg ? (bg + 0x101010) : 0x2D2D2D); // COLOR_HOS_BG_LIGHT.
lv_color_t bgc_press = LV_COLOR_HEX(bg ? (bg + 0x232323) : 0x404040); // 0x505050.
lv_color_t bg_border = LV_COLOR_HEX(bg ? (bg + 0x202020) : 0x3D3D3D); // COLOR_HOS_BG_LIGHTER.
lv_color_t color = lv_color_hsv_to_rgb(hue, 100, 100);
static lv_style_t btn_tgl_pr_test;
lv_style_copy(&btn_tgl_pr_test, lv_btn_get_style(color_test.button, LV_BTN_STATE_TGL_PR));
btn_tgl_pr_test.body.main_color = bgc_press;
btn_tgl_pr_test.body.grad_color = btn_tgl_pr_test.body.main_color;
btn_tgl_pr_test.body.border.color = color;
btn_tgl_pr_test.text.color = color;
if (update_bg) if (update_bg)
{ {
@@ -466,6 +496,27 @@ static void _show_new_nyx_color(u32 bg, u16 hue, bool update_bg)
hdr2_bg_test.body.main_color = bgc; hdr2_bg_test.body.main_color = bgc;
hdr2_bg_test.body.grad_color = hdr2_bg_test.body.main_color; hdr2_bg_test.body.grad_color = hdr2_bg_test.body.main_color;
lv_cont_set_style(color_test.header2, &hdr2_bg_test); lv_cont_set_style(color_test.header2, &hdr2_bg_test);
static lv_style_t btn_tgl_rel_test;
lv_style_copy(&btn_tgl_rel_test, lv_btn_get_style(color_test.btn_apply, LV_BTN_STATE_REL));
btn_tgl_rel_test.body.main_color = bgc_light;
btn_tgl_rel_test.body.grad_color = btn_tgl_rel_test.body.main_color;
lv_btn_set_style(color_test.btn_apply, LV_BTN_STATE_REL, &btn_tgl_rel_test);
lv_btn_set_style(color_test.btn_apply, LV_BTN_STATE_PR, &btn_tgl_pr_test);
lv_btn_set_style(color_test.btn_black, LV_BTN_STATE_REL, &btn_tgl_rel_test);
lv_btn_set_style(color_test.btn_black, LV_BTN_STATE_PR, &btn_tgl_pr_test);
lv_btn_set_style(color_test.btn_reset, LV_BTN_STATE_REL, &btn_tgl_rel_test);
lv_btn_set_style(color_test.btn_reset, LV_BTN_STATE_PR, &btn_tgl_pr_test);
static lv_style_t slider_bg;
lv_style_copy(&slider_bg, lv_slider_get_style(color_test.slider, LV_SLIDER_STYLE_BG));
slider_bg.body.main_color = bg_border;
slider_bg.body.grad_color = slider_bg.body.main_color;
lv_slider_set_style(color_test.hue_slider, LV_SLIDER_STYLE_BG, &slider_bg);
lv_slider_set_style(color_test.slider, LV_SLIDER_STYLE_BG, &slider_bg);
lv_slider_set_style(color_test.r_slider, LV_SLIDER_STYLE_BG, &slider_bg);
lv_slider_set_style(color_test.g_slider, LV_SLIDER_STYLE_BG, &slider_bg);
lv_slider_set_style(color_test.b_slider, LV_SLIDER_STYLE_BG, &slider_bg);
} }
else else
{ {
@@ -474,29 +525,29 @@ static void _show_new_nyx_color(u32 bg, u16 hue, bool update_bg)
txt_test.text.color = color; txt_test.text.color = color;
lv_obj_set_style(color_test.label, &txt_test); lv_obj_set_style(color_test.label, &txt_test);
lv_obj_set_style(color_test.icons, &txt_test); lv_obj_set_style(color_test.icons, &txt_test);
static lv_style_t slider_knb;
lv_style_copy(&slider_knb, lv_slider_get_style(color_test.slider, LV_SLIDER_STYLE_KNOB));
slider_knb.body.main_color = color;
slider_knb.body.grad_color = slider_knb.body.main_color;
lv_slider_set_style(color_test.hue_slider, LV_SLIDER_STYLE_KNOB, &slider_knb);
lv_slider_set_style(color_test.slider, LV_SLIDER_STYLE_KNOB, &slider_knb);
lv_slider_set_style(color_test.r_slider, LV_SLIDER_STYLE_KNOB, &slider_knb);
lv_slider_set_style(color_test.g_slider, LV_SLIDER_STYLE_KNOB, &slider_knb);
lv_slider_set_style(color_test.b_slider, LV_SLIDER_STYLE_KNOB, &slider_knb);
static lv_style_t slider_ind;
lv_style_copy(&slider_ind, lv_slider_get_style(color_test.slider, LV_SLIDER_STYLE_INDIC));
slider_ind.body.main_color = lv_color_hsv_to_rgb(hue, 100, 72);
slider_ind.body.grad_color = slider_ind.body.main_color;
lv_slider_set_style(color_test.hue_slider, LV_SLIDER_STYLE_INDIC, &slider_ind);
lv_slider_set_style(color_test.slider, LV_SLIDER_STYLE_INDIC, &slider_ind);
lv_slider_set_style(color_test.r_slider, LV_SLIDER_STYLE_INDIC, &slider_ind);
lv_slider_set_style(color_test.g_slider, LV_SLIDER_STYLE_INDIC, &slider_ind);
lv_slider_set_style(color_test.b_slider, LV_SLIDER_STYLE_INDIC, &slider_ind);
} }
static lv_style_t btn_tgl_pr_test;
lv_style_copy(&btn_tgl_pr_test, lv_btn_get_style(color_test.button, LV_BTN_STATE_TGL_PR));
btn_tgl_pr_test.body.main_color = bgc_light;
btn_tgl_pr_test.body.grad_color = btn_tgl_pr_test.body.main_color;
btn_tgl_pr_test.body.border.color = color;
btn_tgl_pr_test.text.color = color;
lv_btn_set_style(color_test.button, LV_BTN_STATE_TGL_PR, &btn_tgl_pr_test); lv_btn_set_style(color_test.button, LV_BTN_STATE_TGL_PR, &btn_tgl_pr_test);
static lv_style_t slider_bg, slider_test, slider_ind;
lv_style_copy(&slider_bg, lv_slider_get_style(color_test.slider, LV_SLIDER_STYLE_BG));
lv_style_copy(&slider_test, lv_slider_get_style(color_test.slider, LV_SLIDER_STYLE_KNOB));
lv_style_copy(&slider_ind, lv_slider_get_style(color_test.slider, LV_SLIDER_STYLE_INDIC));
slider_bg.body.main_color = bg_border;
slider_bg.body.grad_color = slider_bg.body.main_color;
slider_test.body.main_color = color;
slider_test.body.grad_color = slider_test.body.main_color;
slider_ind.body.main_color = lv_color_hsv_to_rgb(hue, 100, 72);
slider_ind.body.grad_color = slider_ind.body.main_color;
lv_slider_set_style(color_test.slider, LV_SLIDER_STYLE_BG, &slider_bg);
lv_slider_set_style(color_test.slider, LV_SLIDER_STYLE_KNOB, &slider_test);
lv_slider_set_style(color_test.slider, LV_SLIDER_STYLE_INDIC, &slider_ind);
} }
static lv_res_t _slider_hue_action(lv_obj_t *slider) static lv_res_t _slider_hue_action(lv_obj_t *slider)
@@ -504,7 +555,9 @@ static lv_res_t _slider_hue_action(lv_obj_t *slider)
if (color_test.hue != lv_slider_get_value(slider)) if (color_test.hue != lv_slider_get_value(slider))
{ {
color_test.hue = lv_slider_get_value(slider); color_test.hue = lv_slider_get_value(slider);
_show_new_nyx_color(color_test.bg, color_test.hue, false);
_show_new_nyx_color(false);
char hue[8]; char hue[8];
s_printf(hue, "%03d", color_test.hue); s_printf(hue, "%03d", color_test.hue);
lv_label_set_text(color_test.hue_label, hue); lv_label_set_text(color_test.hue_label, hue);
@@ -513,14 +566,87 @@ static lv_res_t _slider_hue_action(lv_obj_t *slider)
return LV_RES_OK; return LV_RES_OK;
} }
static lv_res_t _preset_bg_action(lv_obj_t *btn) static lv_res_t _slider_r_action(lv_obj_t *slider)
{ {
//! TODO: Support a range? if (color_test.r != lv_slider_get_value(slider))
if (color_test.bg) {
color_test.bg = 0; color_test.r = lv_slider_get_value(slider);
else color_test.box_style.body.main_color = LV_COLOR_HEX((color_test.r << 16) | (color_test.g << 8) | color_test.b);
color_test.bg = COLOR_HOS_BG; color_test.box_style.body.grad_color = color_test.box_style.body.main_color;
_show_new_nyx_color(color_test.bg, color_test.hue, true); lv_obj_set_style(color_test.box, &color_test.box_style);
char shade[8];
s_printf(shade, "%03d", color_test.r);
lv_label_set_text(color_test.r_label, shade);
}
return LV_RES_OK;
}
static lv_res_t _slider_g_action(lv_obj_t *slider)
{
if (color_test.g != lv_slider_get_value(slider))
{
color_test.g = lv_slider_get_value(slider);
color_test.box_style.body.main_color = LV_COLOR_HEX((color_test.r << 16) | (color_test.g << 8) | color_test.b);
color_test.box_style.body.grad_color = color_test.box_style.body.main_color;
lv_obj_set_style(color_test.box, &color_test.box_style);
char shade[8];
s_printf(shade, "%03d", color_test.g);
lv_label_set_text(color_test.g_label, shade);
}
return LV_RES_OK;
}
static lv_res_t _slider_b_action(lv_obj_t *slider)
{
if (color_test.b != lv_slider_get_value(slider))
{
color_test.b = lv_slider_get_value(slider);
color_test.box_style.body.main_color = LV_COLOR_HEX((color_test.r << 16) | (color_test.g << 8) | color_test.b);
color_test.box_style.body.grad_color = color_test.box_style.body.main_color;
lv_obj_set_style(color_test.box, &color_test.box_style);
char shade[8];
s_printf(shade, "%03d", color_test.b);
lv_label_set_text(color_test.b_label, shade);
}
return LV_RES_OK;
}
static lv_res_t _preset_bg_apply(lv_obj_t *btn)
{
color_test.bg = (color_test.r << 16) | (color_test.g << 8) | color_test.b;
_show_new_nyx_color(true);
return LV_RES_OK;
}
static lv_res_t _preset_bg_black(lv_obj_t *btn)
{
color_test.bg = 0;
_show_new_nyx_color(true);
return LV_RES_OK;
}
static lv_res_t _preset_bg_reset(lv_obj_t *btn)
{
color_test.r = (n_cfg.theme_bg >> 16) & 0xFF;
color_test.g = (n_cfg.theme_bg >> 8) & 0xFF;
color_test.b = (n_cfg.theme_bg >> 0) & 0xFF;
color_test.bg = n_cfg.theme_bg;
lv_bar_set_value(color_test.r_slider, color_test.r);
lv_bar_set_value(color_test.g_slider, color_test.g);
lv_bar_set_value(color_test.b_slider, color_test.b);
_show_new_nyx_color(true);
return LV_RES_OK; return LV_RES_OK;
} }
@@ -532,11 +658,13 @@ static lv_res_t _preset_hue_action(lv_obj_t *btn)
if (color_test.hue != ext->idx) if (color_test.hue != ext->idx)
{ {
color_test.hue = ext->idx; color_test.hue = ext->idx;
_show_new_nyx_color(color_test.bg, color_test.hue, false);
char hue[8]; char hue[8];
s_printf(hue, "%03d", color_test.hue); s_printf(hue, "%03d", color_test.hue);
lv_label_set_text(color_test.hue_label, hue); lv_label_set_text(color_test.hue_label, hue);
lv_bar_set_value(color_test.hue_slider, color_test.hue); lv_bar_set_value(color_test.hue_slider, color_test.hue);
_show_new_nyx_color(false);
} }
return LV_RES_OK; return LV_RES_OK;
@@ -546,31 +674,49 @@ static const u16 theme_colors[17] = {
4, 13, 23, 33, 43, 54, 66, 89, 124, 167, 187, 200, 208, 231, 261, 291, 341 4, 13, 23, 33, 43, 54, 66, 89, 124, 167, 187, 200, 208, 231, 261, 291, 341
}; };
lv_res_t _action_win_nyx_colors_close(lv_obj_t * btn)
{
lv_obj_set_opa_scale(status_bar.mid, LV_OPA_COVER);
lv_obj_set_click(status_bar.mid, true);
return nyx_win_close_action(btn);
}
static lv_res_t _create_window_nyx_colors(lv_obj_t *btn) static lv_res_t _create_window_nyx_colors(lv_obj_t *btn)
{ {
lv_obj_t *win = nyx_create_standard_window(SYMBOL_COPY" Nyx Color Theme", NULL); lv_obj_t *win = nyx_create_standard_window(SYMBOL_COPY" Nyx Color Theme", _action_win_nyx_colors_close);
lv_win_add_btn(win, NULL, SYMBOL_HINT" Toggle Background", _preset_bg_action); lv_win_add_btn(win, NULL, SYMBOL_SAVE" Save & Reload", _action_win_nyx_colors_save);
lv_win_add_btn(win, NULL, SYMBOL_SAVE" Save & Reload", _save_theme_color_action);
color_test.window = win; color_test.window = win;
// Set current theme colors. // Set current theme colors.
color_test.bg = n_cfg.theme_bg; color_test.bg = n_cfg.theme_bg;
color_test.hue = n_cfg.theme_color; color_test.hue = n_cfg.theme_color;
u32 bg = n_cfg.theme_bg ? n_cfg.theme_bg : 0x2D2D2D;
color_test.r = (bg >> 16) & 0xFF;
color_test.g = (bg >> 8) & 0xFF;
color_test.b = (bg >> 0) & 0xFF;
lv_obj_t *sep = lv_label_create(win, NULL); lv_style_copy(&color_test.box_style, &lv_style_plain_color);
lv_label_set_static_text(sep, ""); color_test.box_style.body.main_color = LV_COLOR_HEX(color_test.bg);
lv_obj_align(sep, NULL, LV_ALIGN_IN_TOP_MID, 0, 0); color_test.box_style.body.grad_color = color_test.box_style.body.main_color;
color_test.box_style.body.border.color = LV_COLOR_HEX(0xFFFFFF);
color_test.box_style.body.border.opa = LV_OPA_20;
color_test.box_style.body.border.width = 2;
// Create container to keep content inside. // Create container to keep content inside.
lv_obj_t *h1 = lv_cont_create(win, NULL); lv_obj_t *h1 = lv_cont_create(win, NULL);
lv_obj_set_size(h1, LV_HOR_RES - (LV_DPI * 8 / 10), LV_VER_RES / 7); lv_obj_set_size(h1, LV_DPI * 12, LV_DPI * 14 / 13);
color_test.header1 = h1; color_test.header1 = h1;
lv_obj_t *acc_label = lv_label_create(h1, NULL);
lv_label_set_static_text(acc_label, "Accent color:");
// Create color preset buttons. // Create color preset buttons.
lv_obj_t *color_btn = lv_btn_create(h1, NULL); lv_obj_t *color_btn = lv_btn_create(h1, NULL);
lv_btn_ext_t *ext = lv_obj_get_ext_attr(color_btn); lv_btn_ext_t *ext = lv_obj_get_ext_attr(color_btn);
ext->idx = theme_colors[0]; ext->idx = theme_colors[0];
create_flat_button(h1, color_btn, lv_color_hsv_to_rgb(theme_colors[0], 100, 100), _preset_hue_action); create_flat_button(h1, color_btn, lv_color_hsv_to_rgb(theme_colors[0], 100, 100), _preset_hue_action);
lv_obj_align(color_btn, acc_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 10);
lv_obj_t *color_btn2; lv_obj_t *color_btn2;
for (u32 i = 1; i < 17; i++) for (u32 i = 1; i < 17; i++)
@@ -583,44 +729,129 @@ static lv_res_t _create_window_nyx_colors(lv_obj_t *btn)
color_btn = color_btn2; color_btn = color_btn2;
} }
lv_obj_align(h1, sep, LV_ALIGN_OUT_BOTTOM_MID, 0, LV_DPI / 4); lv_obj_align(h1, NULL, LV_ALIGN_IN_TOP_MID, 0, LV_DPI / 5);
// Create hue slider. // Create hue slider.
lv_obj_t * slider = lv_slider_create(win, NULL); lv_obj_t *h_slider = lv_slider_create(win, NULL);
lv_obj_set_width(slider, 1070); lv_obj_set_width(h_slider, 1070);
lv_obj_set_height(slider, LV_DPI * 4 / 10); lv_obj_set_height(h_slider, LV_DPI * 4 / 10);
lv_bar_set_range(slider, 0, 359); lv_bar_set_range(h_slider, 0, 359);
lv_bar_set_value(slider, color_test.hue); lv_bar_set_value(h_slider, color_test.hue);
lv_slider_set_action(slider, _slider_hue_action); lv_slider_set_action(h_slider, _slider_hue_action);
lv_obj_align(slider, h1, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 0); lv_obj_align(h_slider, h1, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 5);
color_test.hue_slider = slider; color_test.hue_slider = h_slider;
// Create hue label. // Create hue label.
lv_obj_t *hue_text_label = lv_label_create(win, NULL); lv_obj_t *hue_text_label = lv_label_create(win, NULL);
lv_obj_align(hue_text_label, slider, LV_ALIGN_OUT_RIGHT_MID, LV_DPI * 24 / 100, 0); lv_obj_align(hue_text_label, h_slider, LV_ALIGN_OUT_RIGHT_MID, LV_DPI * 24 / 100, 0);
char hue[8]; char txt[8];
s_printf(hue, "%03d", color_test.hue); s_printf(txt, "%03d", color_test.hue);
lv_label_set_text(hue_text_label, hue); lv_label_set_text(hue_text_label, txt);
color_test.hue_label = hue_text_label; color_test.hue_label = hue_text_label;
lv_obj_t *bg_label = lv_label_create(win, NULL);
lv_label_set_static_text(bg_label, "Theme color:");
lv_obj_align(bg_label, h_slider, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 5);
// Create red slider.
lv_obj_t *r_slider = lv_slider_create(win, NULL);
lv_obj_set_width(r_slider, 535);
lv_obj_set_height(r_slider, LV_DPI * 4 / 10);
lv_bar_set_range(r_slider, 11, 100);
lv_bar_set_value(r_slider, color_test.r);
lv_slider_set_action(r_slider, _slider_r_action);
lv_obj_align(r_slider, bg_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 21);
color_test.r_slider = r_slider;
// Create red label.
lv_obj_t *r_text_label = lv_label_create(win, NULL);
lv_obj_align(r_text_label, r_slider, LV_ALIGN_OUT_RIGHT_MID, LV_DPI * 24 / 100, 0);
s_printf(txt, "%03d", color_test.r);
lv_label_set_text(r_text_label, txt);
color_test.r_label = r_text_label;
// Create green slider.
lv_obj_t *g_slider = lv_slider_create(win, NULL);
lv_obj_set_width(g_slider, 535);
lv_obj_set_height(g_slider, LV_DPI * 4 / 10);
lv_bar_set_range(g_slider, 11, 100);
lv_bar_set_value(g_slider, color_test.g);
lv_slider_set_action(g_slider, _slider_g_action);
lv_obj_align(g_slider, r_slider, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 7);
color_test.g_slider = g_slider;
// Create green label.
lv_obj_t *g_text_label = lv_label_create(win, NULL);
lv_obj_align(g_text_label, g_slider, LV_ALIGN_OUT_RIGHT_MID, LV_DPI * 24 / 100, 0);
s_printf(txt, "%03d", color_test.g);
lv_label_set_text(g_text_label, txt);
color_test.g_label = g_text_label;
// Create blue slider.
lv_obj_t *b_slider = lv_slider_create(win, NULL);
lv_obj_set_width(b_slider, 535);
lv_obj_set_height(b_slider, LV_DPI * 4 / 10);
lv_bar_set_range(b_slider, 11, 100);
lv_bar_set_value(b_slider, color_test.b);
lv_slider_set_action(b_slider, _slider_b_action);
lv_obj_align(b_slider, g_slider, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 7);
color_test.b_slider = b_slider;
// Create blue label.
lv_obj_t *b_text_label = lv_label_create(win, NULL);
lv_obj_align(b_text_label, b_slider, LV_ALIGN_OUT_RIGHT_MID, LV_DPI * 24 / 100, 0);
s_printf(txt, "%03d", color_test.b);
lv_label_set_text(b_text_label, txt);
color_test.b_label = b_text_label;
// Create theme color box.
lv_obj_t * bg_box = lv_obj_create(win, NULL);
lv_obj_set_size(bg_box, LV_DPI * 10 / 7, LV_DPI * 18 / 13);
lv_obj_align(bg_box, r_text_label, LV_ALIGN_OUT_RIGHT_TOP, LV_DPI / 4, 0);
lv_obj_set_style(bg_box, &color_test.box_style);
color_test.box = bg_box;
// Create theme color buttons.
lv_obj_t *btn_apply = lv_btn_create(win, NULL);
lv_obj_t *label_btn = lv_label_create(btn_apply, NULL);
lv_label_set_static_text(label_btn, SYMBOL_OK" Custom");
lv_btn_set_fit(btn_apply, false, true);
lv_obj_set_width(btn_apply, LV_DPI * 5 / 3);
lv_btn_set_action(btn_apply, LV_BTN_ACTION_CLICK, _preset_bg_apply);
lv_obj_align(btn_apply, bg_box, LV_ALIGN_OUT_RIGHT_TOP, LV_DPI / 5, 0);
color_test.btn_apply = btn_apply;
lv_obj_t *btn_black = lv_btn_create(win, btn_apply);
label_btn = lv_label_create(btn_black, NULL);
lv_label_set_static_text(label_btn, SYMBOL_BRIGHTNESS" Black");
lv_btn_set_action(btn_black, LV_BTN_ACTION_CLICK, _preset_bg_black);
lv_obj_align(btn_black, btn_apply, LV_ALIGN_OUT_RIGHT_TOP, LV_DPI / 5, 0);
color_test.btn_black = btn_black;
lv_obj_t *btn_reset = lv_btn_create(win, btn_apply);
label_btn = lv_label_create(btn_reset, NULL);
lv_label_set_static_text(label_btn, SYMBOL_REFRESH" Reset");
lv_obj_set_width(btn_reset, LV_DPI * 10 / 3 + LV_DPI / 5);
lv_btn_set_action(btn_reset, LV_BTN_ACTION_CLICK, _preset_bg_reset);
lv_obj_align(btn_reset, btn_apply, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 7);
color_test.btn_reset = btn_reset;
// Create sample text. // Create sample text.
lv_obj_t *h2 = lv_cont_create(win, NULL); lv_obj_t *h2 = lv_cont_create(win, NULL);
lv_obj_set_size(h2, LV_HOR_RES - (LV_DPI * 8 / 10), LV_VER_RES / 3); lv_obj_set_size(h2, LV_DPI * 12, LV_DPI * 18 / 10);
lv_obj_align(h2, slider, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI); lv_obj_align(h2, b_slider, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 5);
color_test.header2 = h2; color_test.header2 = h2;
lv_obj_t *lbl_sample = lv_label_create(h2, NULL); lv_obj_t *lbl_sample = lv_label_create(h2, NULL);
lv_label_set_static_text(lbl_sample, "Sample:"); lv_label_set_static_text(lbl_sample, "Accent sample:");
lv_obj_t *lbl_test = lv_label_create(h2, NULL); lv_obj_t *lbl_test = lv_label_create(h2, NULL);
lv_label_set_long_mode(lbl_test, LV_LABEL_LONG_BREAK); lv_label_set_long_mode(lbl_test, LV_LABEL_LONG_BREAK);
lv_label_set_static_text(lbl_test, lv_label_set_static_text(lbl_test,
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, " "Lorem ipsum dolor sit amet, consectetur adipisicing elit, "
"sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. " "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
"Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris "
"nisi ut aliquip ex ea commodo consequat.");
lv_obj_set_width(lbl_test, lv_obj_get_width(h2) - LV_DPI * 6 / 10); lv_obj_set_width(lbl_test, lv_obj_get_width(h2) - LV_DPI * 6 / 10);
lv_obj_align(lbl_test, lbl_sample, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 5); lv_obj_align(lbl_test, lbl_sample, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 34);
color_test.label = lbl_test; color_test.label = lbl_test;
// Create sample icons. // Create sample icons.
@@ -628,12 +859,12 @@ static lv_res_t _create_window_nyx_colors(lv_obj_t *btn)
lv_label_set_static_text(lbl_icons, lv_label_set_static_text(lbl_icons,
SYMBOL_BRIGHTNESS SYMBOL_CHARGE SYMBOL_FILE SYMBOL_DRIVE SYMBOL_FILE_CODE SYMBOL_BRIGHTNESS SYMBOL_CHARGE SYMBOL_FILE SYMBOL_DRIVE SYMBOL_FILE_CODE
SYMBOL_EDIT SYMBOL_HINT SYMBOL_DRIVE SYMBOL_KEYBOARD SYMBOL_POWER); SYMBOL_EDIT SYMBOL_HINT SYMBOL_DRIVE SYMBOL_KEYBOARD SYMBOL_POWER);
lv_obj_align(lbl_icons, lbl_test, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI * 2 / 5); lv_obj_align(lbl_icons, lbl_test, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 5);
color_test.icons = lbl_icons; color_test.icons = lbl_icons;
// Create sample slider. // Create sample slider.
lv_obj_t *slider_test = lv_slider_create(h2, NULL); lv_obj_t *slider_test = lv_slider_create(h2, NULL);
lv_obj_align(slider_test, lbl_test, LV_ALIGN_OUT_BOTTOM_MID, 0, LV_DPI * 2 / 5); lv_obj_align(slider_test, lbl_test, LV_ALIGN_OUT_BOTTOM_MID, 0, LV_DPI / 5);
lv_obj_set_click(slider_test, false); lv_obj_set_click(slider_test, false);
lv_bar_set_value(slider_test, 60); lv_bar_set_value(slider_test, 60);
color_test.slider = slider_test; color_test.slider = slider_test;
@@ -641,12 +872,17 @@ static lv_res_t _create_window_nyx_colors(lv_obj_t *btn)
// Create sample button. // Create sample button.
lv_obj_t *btn_test = lv_btn_create(h2, NULL); lv_obj_t *btn_test = lv_btn_create(h2, NULL);
lv_btn_set_state(btn_test, LV_BTN_STATE_TGL_PR); lv_btn_set_state(btn_test, LV_BTN_STATE_TGL_PR);
lv_obj_align(btn_test, lbl_test, LV_ALIGN_OUT_BOTTOM_RIGHT, 0, LV_DPI / 5);
lv_label_create(btn_test, NULL); lv_label_create(btn_test, NULL);
lv_btn_set_fit(btn_test, false, true);
lv_obj_set_width(btn_test, LV_DPI * 5 / 3);
lv_obj_align(btn_test, lbl_test, LV_ALIGN_OUT_BOTTOM_RIGHT, 0, LV_DPI / 20);
lv_obj_set_click(btn_test, false); lv_obj_set_click(btn_test, false);
color_test.button = btn_test; color_test.button = btn_test;
_show_new_nyx_color(color_test.bg, color_test.hue, false); _show_new_nyx_color(false);
lv_obj_set_opa_scale(status_bar.mid, LV_OPA_0);
lv_obj_set_click(status_bar.mid, false);
return LV_RES_OK; return LV_RES_OK;
} }
@@ -1279,7 +1515,7 @@ lv_res_t create_win_nyx_options(lv_obj_t *parrent_btn)
lv_obj_t *label_txt2 = lv_label_create(sw_h2, NULL); lv_obj_t *label_txt2 = lv_label_create(sw_h2, NULL);
lv_label_set_recolor(label_txt2, true); lv_label_set_recolor(label_txt2, true);
lv_label_set_static_text(label_txt2, "Select a color for all #00FFC8 highlights# in Nyx.\n"); lv_label_set_static_text(label_txt2, "Customize #C7EA46 Theme# and #C7EA46 Accent# colors in Nyx.\n");
lv_obj_set_style(label_txt2, &hint_small_style); lv_obj_set_style(label_txt2, &hint_small_style);
lv_obj_align(label_txt2, btn, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 3 - 8); lv_obj_align(label_txt2, btn, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 3 - 8);

View File

@@ -31,8 +31,6 @@
#include <libs/compr/blz.h> #include <libs/compr/blz.h>
#include <libs/fatfs/ff.h> #include <libs/fatfs/ff.h>
extern volatile boot_cfg_t *b_cfg;
lv_obj_t *ums_mbox; lv_obj_t *ums_mbox;
extern char *emmcsn_path_impl(char *path, char *sub_dir, char *filename, sdmmc_storage_t *storage); extern char *emmcsn_path_impl(char *path, char *sub_dir, char *filename, sdmmc_storage_t *storage);
@@ -1515,7 +1513,7 @@ out_end:
return LV_RES_OK; return LV_RES_OK;
} }
static void _create_tab_tools_emmc_pkg12(lv_theme_t *th, lv_obj_t *parent) static void _create_tab_tools_emmc_sd_usb(lv_theme_t *th, lv_obj_t *parent)
{ {
lv_page_set_scrl_layout(parent, LV_LAYOUT_PRETTY); lv_page_set_scrl_layout(parent, LV_LAYOUT_PRETTY);
@@ -1613,10 +1611,6 @@ static void _create_tab_tools_emmc_pkg12(lv_theme_t *th, lv_obj_t *parent)
lv_obj_set_style(label_txt4, &hint_small_style); lv_obj_set_style(label_txt4, &hint_small_style);
lv_obj_align(label_txt4, btn3, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 3); lv_obj_align(label_txt4, btn3, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 3);
label_sep = lv_label_create(h2, NULL);
lv_label_set_static_text(label_sep, "");
lv_obj_align(label_sep, label_txt4, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI * 11 / 7);
// Create USB Tools button. // Create USB Tools button.
lv_obj_t *btn4 = lv_btn_create(h2, btn3); lv_obj_t *btn4 = lv_btn_create(h2, btn3);
label_btn = lv_label_create(btn4, NULL); label_btn = lv_label_create(btn4, NULL);
@@ -1634,7 +1628,7 @@ static void _create_tab_tools_emmc_pkg12(lv_theme_t *th, lv_obj_t *parent)
lv_obj_align(label_txt4, btn4, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 3); lv_obj_align(label_txt4, btn4, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 3);
} }
static void _create_tab_tools_arc_autorcm(lv_theme_t *th, lv_obj_t *parent) static void _create_tab_tools_arc_rcm_pkg12(lv_theme_t *th, lv_obj_t *parent)
{ {
lv_page_set_scrl_layout(parent, LV_LAYOUT_PRETTY); lv_page_set_scrl_layout(parent, LV_LAYOUT_PRETTY);
@@ -1671,8 +1665,8 @@ static void _create_tab_tools_arc_autorcm(lv_theme_t *th, lv_obj_t *parent)
lv_obj_t *label_txt2 = lv_label_create(h1, NULL); lv_obj_t *label_txt2 = lv_label_create(h1, NULL);
lv_label_set_recolor(label_txt2, true); lv_label_set_recolor(label_txt2, true);
lv_label_set_static_text(label_txt2, lv_label_set_static_text(label_txt2,
"Allows you to fix the archive bit for all folders including\n" "Allows you to fix the archive bit for all folders including the\n"
"the root and emuMMC \'Nintendo\' folders.\n" "root and emuMMC \'Nintendo\' folders.\n"
"#C7EA46 It sets the archive bit to folders named with ##FF8000 .[ext]#\n" "#C7EA46 It sets the archive bit to folders named with ##FF8000 .[ext]#\n"
"#FF8000 Use that option when you have corruption messages.#"); "#FF8000 Use that option when you have corruption messages.#");
lv_obj_set_style(label_txt2, &hint_small_style); lv_obj_set_style(label_txt2, &hint_small_style);
@@ -1689,7 +1683,7 @@ static void _create_tab_tools_arc_autorcm(lv_theme_t *th, lv_obj_t *parent)
lv_label_set_recolor(label_txt2, true); lv_label_set_recolor(label_txt2, true);
lv_label_set_static_text(label_txt2, lv_label_set_static_text(label_txt2,
"Allows you to calibrate the touchscreen module.\n" "Allows you to calibrate the touchscreen module.\n"
"#FF8000 This fixes any issues with touchscreen in Nyx and HOS.#"); "#FF8000 This can fix any issues with touchscreen in Nyx and HOS.#");
lv_obj_set_style(label_txt2, &hint_small_style); lv_obj_set_style(label_txt2, &hint_small_style);
lv_obj_align(label_txt2, btn2, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 3); lv_obj_align(label_txt2, btn2, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 3);
@@ -1712,10 +1706,11 @@ static void _create_tab_tools_arc_autorcm(lv_theme_t *th, lv_obj_t *parent)
lv_obj_t *btn3 = lv_btn_create(h2, NULL); lv_obj_t *btn3 = lv_btn_create(h2, NULL);
if (hekate_bg) if (hekate_bg)
{ {
lv_btn_set_style(btn3, LV_BTN_STYLE_REL, &btn_transp_rel); lv_btn_set_style(btn3, LV_BTN_STYLE_REL, &btn_transp_rel);
lv_btn_set_style(btn3, LV_BTN_STYLE_PR, &btn_transp_pr); lv_btn_set_style(btn3, LV_BTN_STYLE_PR, &btn_transp_pr);
lv_btn_set_style(btn3, LV_BTN_STYLE_TGL_REL, &btn_transp_tgl_rel); lv_btn_set_style(btn3, LV_BTN_STYLE_TGL_REL, &btn_transp_tgl_rel);
lv_btn_set_style(btn3, LV_BTN_STYLE_TGL_PR, &btn_transp_tgl_pr); lv_btn_set_style(btn3, LV_BTN_STYLE_TGL_PR, &btn_transp_tgl_pr);
lv_btn_set_style(btn3, LV_BTN_STYLE_INA, &btn_transp_ina);
} }
label_btn = lv_label_create(btn3, NULL); label_btn = lv_label_create(btn3, NULL);
lv_btn_set_fit(btn3, true, true); lv_btn_set_fit(btn3, true, true);
@@ -1806,8 +1801,8 @@ void create_tab_tools(lv_theme_t *th, lv_obj_t *parent)
lv_line_set_style(line_sep, lv_theme_get_current()->line.decor); lv_line_set_style(line_sep, lv_theme_get_current()->line.decor);
lv_obj_align(line_sep, tv, LV_ALIGN_IN_BOTTOM_MID, -1, -LV_DPI * 2 / 12); lv_obj_align(line_sep, tv, LV_ALIGN_IN_BOTTOM_MID, -1, -LV_DPI * 2 / 12);
_create_tab_tools_emmc_pkg12(th, tab1); _create_tab_tools_emmc_sd_usb(th, tab1);
_create_tab_tools_arc_autorcm(th, tab2); _create_tab_tools_arc_rcm_pkg12(th, tab2);
lv_tabview_set_tab_act(tv, 0, false); lv_tabview_set_tab_act(tv, 0, false);
} }