@opencode/theme 2.0.14 → 2.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
1
  import type { RGBA } from "@opentui/core";
2
- import type { ActionState, ActionVariant, BaseHue, FeedbackKind, HueAlias, HueStep, MarkdownToken, SurfaceName, SyntaxToken } from "./schema.js";
2
+ import type { ActionState, ActionVariant, FeedbackKind, HueStep, MarkdownToken, SemanticHue, SurfaceName, SyntaxToken } from "./schema.js";
3
3
  export type ResolvedActionState = "base" | ActionState;
4
4
  export type ResolvedFormfieldState = ResolvedActionState;
5
5
  export type HueScale = Readonly<Record<HueStep, RGBA>>;
6
- export type Hue = Readonly<Record<BaseHue | HueAlias, HueScale>>;
6
+ export type Hue = Readonly<Record<SemanticHue, HueScale>>;
7
7
  export type HueSource = Readonly<{
8
- hue: BaseHue | HueAlias;
8
+ hue: string;
9
9
  step: HueStep;
10
10
  }>;
11
11
  export type Categorical = readonly HueScale[];
@@ -1,9 +1,16 @@
1
1
  import { RGBA } from "@opentui/core";
2
2
  import { oklchToHex, rgbToOklch } from "./color.js";
3
- import { DEFAULT_CATEGORICAL } from "./categorical.js";
4
3
  import { HueStep } from "./schema.js";
5
4
  const chromaticHues = ["red", "orange", "yellow", "green", "cyan", "blue", "purple"];
6
- const categoricalTokens = ["secondary", "accent", "success", "warning", "primary", "error"];
5
+ const categoricalTokens = [
6
+ "secondary",
7
+ "accent",
8
+ "success",
9
+ "warning",
10
+ "primary",
11
+ "error",
12
+ "info",
13
+ ];
7
14
  const minimumChroma = 0.03;
8
15
  const lightThreshold = 0.6;
9
16
  // Canonical swatches copied from the original default-theme classifier keep V1 migration self-contained.
@@ -82,15 +89,15 @@ function migrateMode(theme, mode) {
82
89
  return referenceHues({
83
90
  hue: {
84
91
  gray: neutralScale(theme),
85
- ...Object.fromEntries(chromaticHues.map((name) => {
92
+ ...Object.fromEntries(chromaticHues.flatMap((name) => {
86
93
  const match = hues.byHue[name];
87
- return [name, match ? hueScale(match.color, mode) : "$hue.gray"];
94
+ return match ? [[name, hueScale(match.color, mode)]] : [];
88
95
  })),
89
96
  accent: hues.byToken.accent ? `$hue.${hues.byToken.accent}` : "$hue.gray",
90
97
  interactive: hues.byToken.primary ? `$hue.${hues.byToken.primary}` : "$hue.gray",
91
98
  neutral: "$hue.gray",
92
99
  },
93
- categorical: uniqueCategorical.length ? uniqueCategorical : DEFAULT_CATEGORICAL,
100
+ categorical: uniqueCategorical.length ? uniqueCategorical : ["neutral"],
94
101
  text: {
95
102
  base: text,
96
103
  muted: textMuted,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@opencode/theme",
4
- "version": "2.0.14",
4
+ "version": "2.0.15",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -1 +0,0 @@
1
- export declare const DEFAULT_CATEGORICAL: readonly ["blue", "purple", "green", "orange", "red", "cyan"];
@@ -1 +0,0 @@
1
- export const DEFAULT_CATEGORICAL = ["blue", "purple", "green", "orange", "red", "cyan"];