Files
Wand-Enhancer/web-panel/src/features/remote-panel/accent-storage.ts
T
kitbyte 13759b1db6 feat: ship 1.0.8.0 release automation and runtime overhaul
- reduce ASAR IO overhead with streamed archive reads, buffered copies, faster relative-path handling and placeholder integrity records
- fix in-place app.asar.unpacked packing/extraction self-copy cases that caused locked-file failures
- tighten JS patch discovery with candidate bundle filters and search hints
- require prebuilt remote-panel dist artifacts and clean up embedded bridge/script packaging
- add unified build entrypoints for PowerShell, cmd and bash and move native CMake output under .tmp
- add release metadata validation, changelog section extraction, pre-commit hook and GitHub Actions validation/release pipelines
- make CHANGELOG the source of truth for release notes and document the tag-driven release flow
- add updater release notes UI with latest/full changelog loading and localize the new update strings
- modularize bridge renderer scripts, add installed apps and game status sync, and support remote launch/stop commands
- centralize bridge protocol, IPC and WebSocket constants and improve LAN IP selection for QR pairing
- refactor remote panel controls/state enums, persist accent color, polish library/session UI and refresh assets
2026-05-06 13:07:09 +03:00

42 lines
1.2 KiB
TypeScript

import { loadJson, saveJson } from './storage';
export const DEFAULT_ACCENT_COLOR = '#00ffd5';
const ACCENT_COLOR_STORAGE_KEY = 'wand-remote.accent-color.v1';
const HEX_COLOR_PATTERN = /^#[0-9a-fA-F]{6}$/;
export function applySavedAccentColor(): string {
return applyAccentColor(loadAccentColor());
}
export function loadAccentColor(): string {
return loadJson<string>(ACCENT_COLOR_STORAGE_KEY, reviveAccentColor, DEFAULT_ACCENT_COLOR);
}
export function setAccentColor(value: string): string {
const nextColor = normalizeAccentColor(value) ?? DEFAULT_ACCENT_COLOR;
applyAccentColor(nextColor);
saveJson(ACCENT_COLOR_STORAGE_KEY, nextColor, (storedValue) => storedValue === DEFAULT_ACCENT_COLOR);
return nextColor;
}
function applyAccentColor(value: string): string {
if (typeof document !== 'undefined') {
document.documentElement.style.setProperty('--deck-accent', value);
}
return value;
}
function reviveAccentColor(raw: unknown): string | null {
return normalizeAccentColor(raw);
}
function normalizeAccentColor(value: unknown): string | null {
if (typeof value !== 'string') {
return null;
}
const normalizedValue = value.trim().toLowerCase();
return HEX_COLOR_PATTERN.test(normalizedValue) ? normalizedValue : null;
}