feat(nav): paint header theme colors via InlineStyleBuilder

Apply SPA header_theme_* as --header-bg/--header-color on .header when
header_theme_custom is enabled (zibll header_theme_custom parity).
This commit is contained in:
2026-07-22 11:42:13 +08:00
parent fc50e57bc9
commit e3848ddf8c
+21 -1
View File
@@ -105,8 +105,28 @@ class InlineStyleBuilder {
echo '--focus-color:' . esc_attr($dark_primary) . ';';
}
echo '}</style>' . "\n";
// Zibll header_theme_custom → --header-bg / --header-color on .header.
if (class_exists('\AKSRT\Settings\Settings')) {
$ht = \AKSRT\Settings\Settings::get_header_theme_config();
if (!empty($ht['custom'])) {
$h_bg = $ht['bg_custom'] !== '' ? $ht['bg_custom'] : ($ht['bg'] ?? '');
$h_fg = $ht['color_custom'] ?? '';
if ($h_bg !== '' || $h_fg !== '') {
echo '<style id="aksrt-header-theme">.header{';
if ($h_bg !== '') {
echo '--header-bg:' . esc_attr($h_bg) . ';background:' . esc_attr($h_bg) . ';';
}
if ($h_fg !== '') {
echo '--header-color:' . esc_attr($h_fg) . ';color:' . esc_attr($h_fg) . ';';
}
echo '}</style>' . "\n";
}
}
}
if (class_exists('\AKSRT\Settings\Settings') && !empty(\AKSRT\Settings\Settings::get_value('close_backdrop', false))) {
echo '<style id="aksrt-no-backdrop">.aksrt-header,.header-inner,.site-header,.mobile-nav-overlay,.modal-backdrop,.aksrt-drawer-overlay,.aksrt-float-btn,.sidebar-inner{backdrop-filter:none!important;-webkit-backdrop-filter:none!important;background-color:var(--bg-card,#fff)!important}</style>' . "\n";
echo '<style id="aksrt-no-backdrop">.aksrt-header,.header-inner,.site-header,.header,.mobile-nav-overlay,.modal-backdrop,.aksrt-drawer-overlay,.aksrt-float-btn,.sidebar-inner{backdrop-filter:none!important;-webkit-backdrop-filter:none!important;background-color:var(--bg-card,#fff)!important}</style>' . "\n";
}
echo '<style id="aksrt-runtime-components">'
. '.aksrt-search-hot-keywords{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-top:12px;font-family:var(--font-ui);}'