界面风格

This commit is contained in:
tianmo committed 2026-11-09 18:40:13 +08:00
1 parent 7ce5ad3166
commit 3e42f940d1
36 files changed
+333 -48

No files matched your search

+16 -1
View File
@@ -10,6 +10,9 @@ const SYSTEM_SETTINGS_CACHE_KEY = 'SpineParticle.SystemSettings.v1'
export type SystemSettingsState = Pick<SettingsState,
| 'uiTheme'
| 'canvasColorMode'
| 'canvasBackgroundColor'
| 'canvasGridColor'
| 'parameterPanelOnRight'
| 'floatingMenuEnabled'
| 'undoLimit'
@@ -42,6 +45,9 @@ function clamp(value: unknown, min: number, max: number, fallback: number) {
export function captureSystemSettings(settings: SettingsState): SystemSettingsState {
return {
uiTheme: settings.uiTheme,
canvasColorMode: settings.canvasColorMode,
canvasBackgroundColor: settings.canvasBackgroundColor,
canvasGridColor: settings.canvasGridColor,
parameterPanelOnRight: settings.parameterPanelOnRight,
floatingMenuEnabled: settings.floatingMenuEnabled,
undoLimit: settings.undoLimit,
@@ -67,11 +73,20 @@ function normalizedSystemSettings(value: Partial<SystemSettingsState>, current:
const axisColor = typeof value.axisColor === 'string' && /^#[0-9a-f]{6}$/i.test(value.axisColor)
? value.axisColor
: current.axisColor
const uiTheme = value.uiTheme === 'gray-white' || value.uiTheme === 'deep-blue'
const uiTheme = value.uiTheme === 'gray-white'
|| value.uiTheme === 'deep-blue'
|| value.uiTheme === 'light'
|| value.uiTheme === 'dark'
? value.uiTheme
: current.uiTheme
const canvasColorMode = value.canvasColorMode === 'custom' ? 'custom' : 'theme'
const colorValue = (color: unknown, fallback: string) =>
typeof color === 'string' && /^#[0-9a-f]{6}$/i.test(color) ? color : fallback
return {
uiTheme,
canvasColorMode,
canvasBackgroundColor: colorValue(value.canvasBackgroundColor, current.canvasBackgroundColor),
canvasGridColor: colorValue(value.canvasGridColor, current.canvasGridColor),
parameterPanelOnRight: booleanValue('parameterPanelOnRight'),
floatingMenuEnabled: booleanValue('floatingMenuEnabled'),
undoLimit: Math.round(clamp(value.undoLimit, 1, 200, current.undoLimit)),