@opencode-ai/theme
Advanced tools
| export { ActionState, type ActionStateKey, ActionVariant, BaseHue, CategoricalDefinition, FeedbackKind, FormfieldState, type FormfieldStateKey, HueAlias, HueName, HueStep, MarkdownDefinition, MarkdownToken, ModeDefinition, SyntaxDefinition, SyntaxToken, ThemeDefinition, ThemeDocument, type BackgroundDefinition, type DiffDefinition, type FileThemeDefinition, type FormfieldColorDefinition, type HueDefinition, type HueOverrideDefinition, type MergeModeDefinition, type Mode, type StatefulColorDefinition, type ContextKey, type TextDefinition, type ThemeTokensDefinition, } from "./schema.js"; | ||
| export type { Categorical, FormfieldColor, Hue, HueSource, HueScale, ResolvedActionState, ResolvedFormfieldState, ResolvedTheme, ResolvedThemeView, StatefulColor, } from "./types.js"; | ||
| export type { Categorical, ContextName, FormfieldColor, Hue, HueSource, HueScale, ResolvedActionState, ResolvedFormfieldState, ResolvedTheme, ResolvedThemeTokens, StatefulColor, } from "./types.js"; | ||
| export { DEFAULT_CATEGORICAL, DEFAULT_THEME } from "./defaults.js"; | ||
@@ -4,0 +4,0 @@ export { migrateV1 } from "./v1-migrate.js"; |
+11
-7
@@ -44,9 +44,13 @@ import { RGBA } from "@opentui/core"; | ||
| const resolved = resolveView(base, hue, categorical, hueSteps); | ||
| const contexts = Object.fromEntries(Object.entries(definition) | ||
| .filter(([key]) => key.startsWith("@context:")) | ||
| .map(([key, override]) => { | ||
| const contextual = contextualize(base, override); | ||
| return [key, resolveView(contextual, hue, categorical, hueSteps)]; | ||
| })); | ||
| return { ...resolved, contexts }; | ||
| const context = (name) => { | ||
| const override = definition[`@context:${name}`]; | ||
| if (!override) | ||
| return resolved; | ||
| return resolveView(contextualize(base, override), hue, categorical, hueSteps); | ||
| }; | ||
| const contextual = { | ||
| elevated: context("elevated"), | ||
| overlay: context("overlay"), | ||
| }; | ||
| return { ...resolved, contextual }; | ||
| } | ||
@@ -53,0 +57,0 @@ function tokens(definition) { |
| import { SyntaxStyle } from "@opentui/core"; | ||
| import type { Mode, ResolvedThemeView } from "./index.js"; | ||
| export declare function generateSyntax(theme: ResolvedThemeView, mode: Mode): SyntaxStyle; | ||
| import type { Mode, ResolvedThemeTokens } from "./index.js"; | ||
| export declare function generateSyntax(theme: ResolvedThemeTokens, mode: Mode): SyntaxStyle; |
| import type { RGBA } from "@opentui/core"; | ||
| import type { ActionState, ActionVariant, BaseHue, FeedbackKind, HueAlias, HueStep, MarkdownToken, ContextKey, SyntaxToken } from "./schema.js"; | ||
| import type { ActionState, ActionVariant, BaseHue, FeedbackKind, HueAlias, HueStep, MarkdownToken, SyntaxToken } from "./schema.js"; | ||
| export type ResolvedActionState = "default" | ActionState; | ||
@@ -14,3 +14,3 @@ export type ResolvedFormfieldState = ResolvedActionState; | ||
| export type FormfieldColor = StatefulColor; | ||
| export type ResolvedThemeView = { | ||
| export type ResolvedThemeTokens = { | ||
| readonly hue: Hue; | ||
@@ -76,4 +76,5 @@ readonly categorical: Categorical; | ||
| }; | ||
| export type ResolvedTheme = ResolvedThemeView & { | ||
| readonly contexts: Readonly<Partial<Record<ContextKey, ResolvedThemeView>>>; | ||
| export type ContextName = "elevated" | "overlay"; | ||
| export type ResolvedTheme = ResolvedThemeTokens & { | ||
| readonly contextual: Readonly<Record<ContextName, ResolvedThemeTokens>>; | ||
| }; |
+1
-1
| { | ||
| "$schema": "https://json.schemastore.org/package.json", | ||
| "name": "@opencode-ai/theme", | ||
| "version": "0.0.0-next-16420", | ||
| "version": "0.0.0-next-16473", | ||
| "type": "module", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
831740
0.01%8184
0.06%