Skip to content

Commit 342b003

Browse files
committed
adjust hue accessors
1 parent 2bb254b commit 342b003

6 files changed

Lines changed: 22 additions & 7 deletions

File tree

packages/tui/src/component/prompt/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1576,7 +1576,7 @@ export function Prompt(props: PromptProps) {
15761576
<Match when={move.progress()}>
15771577
{(progress) => (
15781578
<box paddingLeft={3}>
1579-
<Spinner color={themeV2.hue().accent[300]}>
1579+
<Spinner color={themeV2.hue.accent(500)}>
15801580
{progress()}
15811581
<span style={{ fg: themeV2.text.subdued() }}>{".".repeat(move.creatingDots())}</span>
15821582
</Spinner>
@@ -1585,7 +1585,7 @@ export function Prompt(props: PromptProps) {
15851585
</Match>
15861586
<Match when={move.pendingNew()}>
15871587
<box paddingLeft={3}>
1588-
<text fg={themeV2.hue().accent[300]}>(new working copy)</text>
1588+
<text fg={themeV2.hue.accent(500)}>(new working copy)</text>
15891589
</box>
15901590
</Match>
15911591
<Match when={true}>
@@ -1607,7 +1607,7 @@ export function Prompt(props: PromptProps) {
16071607
<text
16081608
fg={
16091609
editorContextLabelState() === "pending"
1610-
? themeV2.hue().accent[500]
1610+
? themeV2.hue.accent(500)
16111611
: themeV2.text.subdued()
16121612
}
16131613
>

packages/tui/src/context/local.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export const { use: useLocal, provider: LocalProvider } = createSimpleContext({
8484
current: undefined as string | undefined,
8585
})
8686
const colors = createMemo(() => [
87-
themeV2.hue().accent[500],
87+
themeV2.hue.accent(500),
8888
theme.accent,
8989
theme.success,
9090
theme.warning,

packages/tui/src/routes/session/form.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ export function FormPrompt(props: { form: FormWithLocation }) {
754754
<box
755755
backgroundColor={themeV2.background()}
756756
border={["left"]}
757-
borderColor={themeV2.hue().accent[300]}
757+
borderColor={themeV2.hue.accent(500)}
758758
customBorderChars={SplitBorder.customBorderChars}
759759
>
760760
<box gap={1} paddingLeft={1} paddingRight={3} paddingTop={1} paddingBottom={1}>

packages/tui/src/routes/session/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1601,7 +1601,7 @@ function UserMessage(props: { message: SessionMessageUser }) {
16011601
<text fg={themeV2.text()}>
16021602
<span
16031603
style={{
1604-
bg: themeV2.hue().accent[500],
1604+
bg: themeV2.hue.accent(500),
16051605
fg: themeV2.background(),
16061606
bold: true,
16071607
}}

packages/tui/src/theme/v2/component.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,26 @@ import type {
77
ResolvedActionState,
88
ResolvedFormfieldState,
99
ResolvedThemeView,
10+
HueStep,
1011
} from "./index"
1112

1213
export function createComponentTheme(current: Accessor<ResolvedThemeView>) {
1314
const textAction = actions((variant, state) => current().text.action[variant][state])
1415
const backgroundAction = actions((variant, state) => current().background.action[variant][state])
1516
const textFormfield = formfield((state) => current().text.formfield[state])
1617
const backgroundFormfield = formfield((state) => current().background.formfield[state])
18+
const hue = {
19+
gray: (step: HueStep) => current().hue.gray[step],
20+
red: (step: HueStep) => current().hue.red[step],
21+
orange: (step: HueStep) => current().hue.orange[step],
22+
yellow: (step: HueStep) => current().hue.yellow[step],
23+
green: (step: HueStep) => current().hue.green[step],
24+
cyan: (step: HueStep) => current().hue.cyan[step],
25+
blue: (step: HueStep) => current().hue.blue[step],
26+
purple: (step: HueStep) => current().hue.purple[step],
27+
accent: (step: HueStep) => current().hue.accent[step],
28+
neutral: (step: HueStep) => current().hue.neutral[step],
29+
}
1730
const text = Object.assign(() => current().text.default, {
1831
subdued: () => current().text.subdued,
1932
action: textAction,
@@ -62,7 +75,7 @@ export function createComponentTheme(current: Accessor<ResolvedThemeView>) {
6275
}
6376

6477
return {
65-
hue: () => current().hue,
78+
hue,
6679
text,
6780
background,
6881
border: () => current().border.default,

packages/tui/test/theme/v2/component.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ test("provides reactive property, variant, state, and context accessors", () =>
1515
})
1616

1717
expect(theme.text()).toBe(resolved().text.default)
18+
expect(theme.hue.accent(500)).toBe(resolved().hue.accent[500])
19+
expect(theme.hue.gray(200)).toBe(resolved().hue.gray[200])
1820
expect(theme.text.subdued()).toBe(resolved().text.subdued)
1921
expect(theme.text.action()).toBe(resolved().text.action.primary.default)
2022
expect(theme.text.action.primary("pressed")).toBe(resolved().text.action.primary.pressed)

0 commit comments

Comments
 (0)