feat(tui): expose native OpenCode theme
This commit is contained in:
parent
8f3465c951
commit
04c23b8846
4 changed files with 14 additions and 5 deletions
|
|
@ -1,11 +1,13 @@
|
|||
import { Schema } from "effect"
|
||||
import { resolveThemeColors } from "./resolve"
|
||||
import { DEFAULT_THEMES, type Theme, type ThemeV1Json } from "./v1"
|
||||
import { DEFAULT_THEMES_V1, type Theme, type ThemeV1Json } from "./v1"
|
||||
import { DEFAULT_THEMES_V2 } from "./v2/defaults"
|
||||
import { resolveThemeDocument, themeDecodeError } from "./v2/resolve"
|
||||
import { ThemeDocument } from "./v2/schema"
|
||||
import { migrateV1 } from "./v2/v1-migrate"
|
||||
|
||||
export { DEFAULT_THEMES, generateSyntax, selectedForeground, type Theme, type ThemeV1Json } from "./v1"
|
||||
export { DEFAULT_THEMES, DEFAULT_THEMES_V1, generateSyntax, selectedForeground, type Theme, type ThemeV1Json } from "./v1"
|
||||
export { DEFAULT_THEMES_V2 } from "./v2/defaults"
|
||||
export { resolveThemeDocument, type ThemeDocument }
|
||||
|
||||
export type ThemeDocumentSource = Record<string, unknown>
|
||||
|
|
@ -20,7 +22,8 @@ const decodeThemeDocument = Schema.decodeUnknownSync(ThemeDocument)
|
|||
function listThemes() {
|
||||
// Priority: defaults < plugin installs < custom files < generated system.
|
||||
const themes: Record<string, ThemeDocumentSource> = {
|
||||
...DEFAULT_THEMES,
|
||||
...DEFAULT_THEMES_V1,
|
||||
...DEFAULT_THEMES_V2,
|
||||
...pluginThemes,
|
||||
...customThemes,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ export type ThemeV1Json = {
|
|||
}
|
||||
}
|
||||
|
||||
export const DEFAULT_THEMES: Record<string, ThemeV1Json> = {
|
||||
export const DEFAULT_THEMES_V1: Record<string, ThemeV1Json> = {
|
||||
aura,
|
||||
ayu,
|
||||
catppuccin,
|
||||
|
|
@ -144,6 +144,8 @@ export const DEFAULT_THEMES: Record<string, ThemeV1Json> = {
|
|||
carbonfox,
|
||||
}
|
||||
|
||||
export const DEFAULT_THEMES = DEFAULT_THEMES_V1
|
||||
|
||||
export function selectedForeground(theme: Theme, bg?: RGBA): RGBA {
|
||||
if (theme._hasSelectedListItemText) return theme.selectedListItemText
|
||||
|
||||
|
|
|
|||
|
|
@ -438,3 +438,7 @@ export const DEFAULT_THEME = {
|
|||
},
|
||||
},
|
||||
} satisfies ThemeDocument
|
||||
|
||||
export const DEFAULT_THEMES_V2 = {
|
||||
"opencode-v2": DEFAULT_THEME,
|
||||
} as const satisfies Record<string, ThemeDocument>
|
||||
|
|
|
|||
|
|
@ -43,6 +43,6 @@ export type {
|
|||
ResolvedThemeView,
|
||||
StatefulColor,
|
||||
} from "./types"
|
||||
export { DEFAULT_CATEGORICAL } from "./defaults"
|
||||
export { DEFAULT_CATEGORICAL, DEFAULT_THEME, DEFAULT_THEMES_V2 } from "./defaults"
|
||||
export { migrateV1 } from "./v1-migrate"
|
||||
export { selectTheme, selectThemeMode, supportsThemeMode, themeModes } from "./select"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue