initial commit for theme engine

This commit is contained in:
Boof2015
2026-03-28 18:00:12 -04:00
parent a38b54b5e2
commit ee234cad7c
30 changed files with 2585 additions and 337 deletions
+21 -1
View File
@@ -1,6 +1,16 @@
import type { CaptureBackendKind } from './capture'
import type { ScopeKind } from './scope'
import type { ScopeSettings } from './settings'
import type {
ResolvedInterfaceTheme,
ResolvedLUFSMeterTheme,
ResolvedOscilloscopeTheme,
ResolvedSpectrogramTheme,
ResolvedSpectrumTheme,
ResolvedVectorscopeTheme,
ResolvedVUMeterTheme,
ResolvedWaveformTheme,
} from './theme'
export interface WindowBounds {
x: number
@@ -40,9 +50,19 @@ export type ScopePopoutMonoBatch = Float32Array[]
export type ScopePopoutStereoBatch = ScopePopoutStereoChunk[]
export type ScopePopoutAudioBatch = ScopePopoutMonoBatch | ScopePopoutStereoBatch
export type ScopePopoutResolvedScopeTheme =
| ResolvedSpectrumTheme
| ResolvedOscilloscopeTheme
| ResolvedVectorscopeTheme
| ResolvedSpectrogramTheme
| ResolvedVUMeterTheme
| ResolvedLUFSMeterTheme
| ResolvedWaveformTheme
export interface ScopePopoutSnapshot<K extends ScopeKind = ScopeKind> {
kind: K
label: string
accent: string
interfaceTheme: ResolvedInterfaceTheme
scopeTheme: ScopePopoutResolvedScopeTheme
settings: ScopeSettings[K]
}
+18 -2
View File
@@ -3,7 +3,7 @@ import type { ScopeKind } from './scope'
import type { ScopeSettings } from './settings'
export const PROFILE_FILE_FORMAT = 'prism-profile'
export const PROFILE_FILE_VERSION = 1
export const PROFILE_FILE_VERSION = 2
export const PROFILE_LOCAL_STATE_FORMAT = 'prism-profile-local'
export const PROFILE_LOCAL_STATE_VERSION = 1
export const LEGACY_PROFILE_MIGRATION_VERSION = 1
@@ -12,6 +12,7 @@ export const DEFAULT_PROFILE_NAME = 'Default'
export interface Profile {
name: string
themeId: string | null
scopeOrder: ScopeKind[]
hiddenScopes: ScopeKind[]
widthWeights: Record<ScopeKind, number>
@@ -28,7 +29,7 @@ export type PrismProfileFileScopePopoutMap = Record<ScopeKind, PrismProfileFileS
export interface PrismProfileFileV1 {
format: typeof PROFILE_FILE_FORMAT
version: typeof PROFILE_FILE_VERSION
version: 1
id: string
name: string
scopeOrder: ScopeKind[]
@@ -38,6 +39,21 @@ export interface PrismProfileFileV1 {
scopePopouts: PrismProfileFileScopePopoutMap
}
export interface PrismProfileFileV2 {
format: typeof PROFILE_FILE_FORMAT
version: typeof PROFILE_FILE_VERSION
id: string
name: string
themeId: string | null
scopeOrder: ScopeKind[]
hiddenScopes: ScopeKind[]
widthWeights: Record<ScopeKind, number>
scopeSettings: ScopeSettings
scopePopouts: PrismProfileFileScopePopoutMap
}
export type PrismProfileFile = PrismProfileFileV1 | PrismProfileFileV2
export interface ProfileLocalMetadata {
windowBounds?: WindowBounds
scopePopoutBounds?: Partial<Record<ScopeKind, WindowBounds>>
+199
View File
@@ -0,0 +1,199 @@
import type { ScopeKind } from './scope'
export const THEME_FILE_FORMAT = 'prism-theme'
export const THEME_FILE_VERSION = 1
export const THEME_LOCAL_STATE_FORMAT = 'prism-theme-local'
export const THEME_LOCAL_STATE_VERSION = 1
export const LEGACY_THEME_MIGRATION_VERSION = 1
export const DEFAULT_THEME_ID = 'theme_default'
export const DEFAULT_THEME_NAME = 'Default'
export type ThemeSectionName =
| 'all'
| 'interface'
| ScopeKind
export interface ThemeTokens {
primary?: string
secondary?: string
guides?: string
text?: string
background?: string
lowBand?: string
midBand?: string
highBand?: string
fill?: string
peak?: string
clip?: string
target?: string
heatLow?: string
heatMid?: string
heatHigh?: string
success?: string
warning?: string
danger?: string
}
export interface PrismTheme {
id: string
name: string
credit?: string
website?: string
description?: string
all: ThemeTokens
interface: ThemeTokens
spectrum: ThemeTokens
oscilloscope: ThemeTokens
vectorscope: ThemeTokens
spectrogram: ThemeTokens
vumeter: ThemeTokens
lufsmeter: ThemeTokens
waveform: ThemeTokens
}
export interface PrismThemeLocalStateV1 {
format: typeof THEME_LOCAL_STATE_FORMAT
version: typeof THEME_LOCAL_STATE_VERSION
migrationVersion: number
activeThemeId: string | null
}
export interface ThemeSummary {
id: string
name: string
isDefault: boolean
}
export interface ThemeLibrarySnapshot {
themes: Record<string, PrismTheme>
activeThemeId: string | null
}
export interface LegacyThemeMigrationPayload {
presetId: string | null
customAccent: string | null
}
export interface LegacyThemeMigrationResult {
didMigrate: boolean
snapshot: ThemeLibrarySnapshot
}
export interface ResolvedInterfaceTheme {
primary: string
secondary: string
guides: string
text: string
background: string
accent: string
accentHover: string
accentGlow: string
accentRgb: string
bgPrimary: string
bgSecondary: string
bgTertiary: string
panelSurface: string
panelSurfaceSoft: string
panelOutline: string
panelOutlineStrong: string
glassBg: string
glassBorder: string
glassHighlight: string
textPrimary: string
textSecondary: string
textTertiary: string
textMuted: string
toolbarBg: string
settingsBgTop: string
settingsBgBottom: string
bottomBarBg: string
menuBg: string
menuBorder: string
controlBg: string
controlBgHover: string
controlBgActive: string
controlBorder: string
controlBorderActive: string
inputBg: string
inputBgFocus: string
inputBorder: string
inputBorderFocus: string
divider: string
success: string
warning: string
danger: string
}
export interface ResolvedSpectrumTheme {
primary: string
secondary: string
guides: string
background: string
fillGradient: [string, string, string]
heatColors: [string, string, string]
}
export interface ResolvedOscilloscopeTheme {
primary: string
guides: string
background: string
fill: string
}
export interface ResolvedVectorscopeTheme {
primary: string
guides: string
background: string
lowBand: string
midBand: string
highBand: string
}
export interface ResolvedSpectrogramTheme {
primary: string
guides: string
background: string
heatColors: [string, string, string]
}
export interface ResolvedVUMeterTheme {
primary: string
peak: string
clip: string
guides: string
text: string
background: string
}
export interface ResolvedLUFSMeterTheme {
primary: string
target: string
guides: string
text: string
background: string
}
export interface ResolvedWaveformTheme {
primary: string
guides: string
background: string
lowBand: string
midBand: string
highBand: string
}
export interface PrismResolvedTheme {
id: string
name: string
credit?: string
website?: string
description?: string
interface: ResolvedInterfaceTheme
spectrum: ResolvedSpectrumTheme
oscilloscope: ResolvedOscilloscopeTheme
vectorscope: ResolvedVectorscopeTheme
spectrogram: ResolvedSpectrogramTheme
vumeter: ResolvedVUMeterTheme
lufsmeter: ResolvedLUFSMeterTheme
waveform: ResolvedWaveformTheme
}