mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-14 03:56:55 +03:00
refactor(tui): remove unused plugin theme registration (#52992)
This commit is contained in:
committed by
GitHub
Unverified
parent
ee730bdd91
commit
9c66a0acb0
@@ -7,7 +7,6 @@ export { DEFAULT_THEMES, type Theme, type ThemeV1Json } from "./v1"
|
||||
|
||||
export type ThemeDocumentSource = Record<string, unknown>
|
||||
|
||||
const pluginThemes: Record<string, ThemeDocumentSource> = {}
|
||||
let customThemes: Record<string, ThemeDocumentSource> = {}
|
||||
let systemTheme: ThemeDocumentSource | undefined
|
||||
const listeners = new Set<(themes: Record<string, ThemeDocumentSource>) => void>()
|
||||
@@ -25,11 +24,10 @@ export function getOpenCodeTheme() {
|
||||
}
|
||||
|
||||
function listThemes(): Record<string, ThemeDocumentSource> {
|
||||
// Priority: defaults < plugin installs < custom files < generated system.
|
||||
// Priority: defaults < custom files < generated system.
|
||||
const themes: Record<string, ThemeDocumentSource> = {
|
||||
...DEFAULT_THEMES,
|
||||
opencode: getOpenCodeTheme(),
|
||||
...pluginThemes,
|
||||
...customThemes,
|
||||
}
|
||||
return {
|
||||
@@ -84,27 +82,6 @@ export function hasTheme(name: string) {
|
||||
return allThemes()[name] !== undefined
|
||||
}
|
||||
|
||||
export function addTheme(name: string, theme: unknown) {
|
||||
if (!name) return false
|
||||
if (!isThemeSource(theme)) return false
|
||||
if (hasTheme(name)) return false
|
||||
pluginThemes[name] = theme
|
||||
syncThemes()
|
||||
return true
|
||||
}
|
||||
|
||||
export function upsertTheme(name: string, theme: unknown) {
|
||||
if (!name) return false
|
||||
if (!isThemeSource(theme)) return false
|
||||
if (customThemes[name] !== undefined) {
|
||||
customThemes[name] = theme
|
||||
} else {
|
||||
pluginThemes[name] = theme
|
||||
}
|
||||
syncThemes()
|
||||
return true
|
||||
}
|
||||
|
||||
export function resolveTheme(theme: ThemeV1Json, mode: "dark" | "light"): Theme {
|
||||
const resolved = resolveThemeColors(theme, mode)
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user