M2.90: MIUIx 风格包落地 + ui.style 一键切换闭环
- meow_ui_theme.c: 为 MEOW_STYLE_MIUIX 实现整套 light/dark 配色(暖基面+小米橙 primary 0xF57200/0xFF8C4A+蓝 tertiary;圆角 20/卡片 28、间距 12、细描边 1),与 MD3 可感知差异 - display.background 随 style×mode 派生 MIUIx 色板(bg_surfaces 增 style 参;图片背景保持各 style 默认面) - meow_settings.c g_defs: ui.style 值域 'md3,miui'→'md3,miuix'(label Material You,MIUIx); apply_value SET_ENUM 对存量 'miui' 兼容映射为 miuix - settings_page s_commit: ui.style 分支 → meow_ui_set_style + paint_sb_right + meow_dirty_full 即时换肤 - font_theme s_ui_theme() 接 ui.style + MIUIx dark/light 表;main_menu 背景签名含 ui.style + 纯色底随 style 换族 - 宿主编译 -Wall -Wextra 0 warning;test_meow_ui_theme 四套 s×m 渲染全 PASS; test_meow_ui_widgets/test_sdk_fixes 全 PASS(MD3 行为一致) - 产物 md5: meow_ui.a a4231296 / launcher 9f97af1b(未部署走固件)/ hello e5527578 / files 993e41ca / ncm 6b9eeb0f(三 App 已 .new+mv 热更到卡, 设备 md5 已核一致) - 待后续: 状态栏图标集仍 MD3 一套(sb_icons.h 无 per-style 换集接口, MIUIx 仅换配色); App 进程 SDK 主题缓存 g_loaded 不随 settings 外部改写重读, 运行中 App 下次启动才换肤
This commit is contained in:
1 parent
f23720f934
commit
4e3f41a5a3
13 files changed
+250
-42
No files matched your search
@@ -214,15 +214,18 @@ static int menu_is_dark(const meow_ui_theme_t *th)
|
||||
return th ? (th->on_surface > 0x808080) : 1;
|
||||
}
|
||||
|
||||
/* 背景设置签名:display.background 串 + 叠加层强度 + 明暗。变化才重建缓存。 */
|
||||
/* 背景设置签名:display.background 串 + 叠加层强度 + 明暗 + ui.style(§8.1.1:背景底随
|
||||
* style×mode 换族)。变化才重建缓存——ui.style 切换必须入签名,否则切风格后主界面背景滞留旧族。 */
|
||||
static unsigned menu_bg_sig(const meow_ui_theme_t *th, int ov)
|
||||
{
|
||||
char bg[MEOW_SET_MAX_LEN];
|
||||
if (meow_settings_get_str("display.background", bg, sizeof bg) != 0) bg[0] = 0;
|
||||
int style = 0; if (meow_settings_get_enum("ui.style", &style) != 0) style = 0;
|
||||
unsigned h = 2166136261u;
|
||||
for (const char *p = bg; *p; p++) { h ^= (unsigned char)*p; h *= 16777619u; }
|
||||
h = h * 31u + (unsigned)ov;
|
||||
h = h * 31u + (unsigned)menu_is_dark(th);
|
||||
h = h * 31u + (unsigned)style;
|
||||
return h;
|
||||
}
|
||||
|
||||
@@ -291,10 +294,17 @@ static void menu_bg_prepare(const meow_ui_theme_t *th)
|
||||
menu_bg = th->surface;
|
||||
s_bg_img = menu_bg_load_img(bg);
|
||||
if (s_bg_img) s_bg_is_img = 1;
|
||||
} else { /* 纯色名(沿用既有 black/blue/green 语义) */
|
||||
if (!strcmp(bg, "blue")) menu_bg = 0x0A1428; /* 深蓝 */
|
||||
else if (!strcmp(bg, "green")) menu_bg = 0x0A2814; /* 深绿 */
|
||||
else menu_bg = 0x000000; /* black(默认) */
|
||||
} else { /* 纯色名(沿用既有 black/blue/green 语义;随 ui.style 换族) */
|
||||
int mstyle = 0; if (meow_settings_get_enum("ui.style", &mstyle) != 0) mstyle = 0;
|
||||
if (mstyle == MEOW_STYLE_MIUIX) { /* MIUIx 暖色族(与 SDK bg_surfaces 同色) */
|
||||
if (!strcmp(bg, "blue")) menu_bg = 0x101A2E;
|
||||
else if (!strcmp(bg, "green")) menu_bg = 0x14251A;
|
||||
else menu_bg = 0x181310; /* black(默认)=MIUIx 深色面 */
|
||||
} else { /* MD3(既有) */
|
||||
if (!strcmp(bg, "blue")) menu_bg = 0x0A1428; /* 深蓝 */
|
||||
else if (!strcmp(bg, "green")) menu_bg = 0x0A2814; /* 深绿 */
|
||||
else menu_bg = 0x000000; /* black(默认) */
|
||||
}
|
||||
}
|
||||
menu_bg_cache_build(th);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user