Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/cli/src/ui/components/Header.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ describe('<Header />', () => {
comment: '',
symbol: '',
dark: '',
focus: '',
gradient: undefined,
},
status: {
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/src/ui/components/SessionBrowser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import type React from 'react';
import { useState, useCallback, useMemo, useEffect, useRef } from 'react';
import { Box, Text } from 'ink';
import { Colors } from '../colors.js';
import { theme } from '../semantic-colors.js';
import { useTerminalSize } from '../hooks/useTerminalSize.js';
import { useKeypress } from '../hooks/useKeypress.js';
import path from 'node:path';
Expand Down Expand Up @@ -436,7 +437,7 @@ const SessionItem = ({
if (isDisabled) {
return Colors.Gray;
}
return isActive ? Colors.AccentPurple : c;
return isActive ? theme.ui.focus : c;
};

const prefix = isActive ? '❯ ' : ' ';
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/ui/components/SuggestionsDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export function SuggestionsDisplay({
const originalIndex = startIndex + index;
const isActive = originalIndex === activeIndex;
const isExpanded = originalIndex === expandedIndex;
const textColor = isActive ? theme.text.accent : theme.text.secondary;
const textColor = isActive ? theme.ui.focus : theme.text.secondary;
const isLong = suggestion.value.length >= MAX_WIDTH;
const labelElement = (
<ExpandableText
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/src/ui/components/shared/BaseSelectionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ export function BaseSelectionList<
let numberColor = theme.text.primary;

if (isSelected) {
titleColor = theme.status.success;
numberColor = theme.status.success;
titleColor = theme.ui.focus;
numberColor = theme.ui.focus;
} else if (item.disabled) {
titleColor = theme.text.secondary;
numberColor = theme.text.secondary;
Expand All @@ -141,7 +141,7 @@ export function BaseSelectionList<
{/* Radio button indicator */}
<Box minWidth={2} flexShrink={0}>
<Text
color={isSelected ? theme.status.success : theme.text.primary}
color={isSelected ? theme.ui.focus : theme.text.primary}
aria-hidden
>
{isSelected ? '●' : ' '}
Expand Down
10 changes: 3 additions & 7 deletions packages/cli/src/ui/components/shared/BaseSettingsDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -517,9 +517,7 @@ export function BaseSettingsDialog({
<Box marginX={1} flexDirection="row" alignItems="flex-start">
<Box minWidth={2} flexShrink={0}>
<Text
color={
isActive ? theme.status.success : theme.text.secondary
}
color={isActive ? theme.ui.focus : theme.text.secondary}
>
{isActive ? '●' : ''}
</Text>
Expand All @@ -536,9 +534,7 @@ export function BaseSettingsDialog({
minWidth={0}
>
<Text
color={
isActive ? theme.status.success : theme.text.primary
}
color={isActive ? theme.ui.focus : theme.text.primary}
>
{item.label}
{item.scopeMessage && (
Expand All @@ -557,7 +553,7 @@ export function BaseSettingsDialog({
<Text
color={
isActive
? theme.status.success
? theme.ui.focus
: item.isGreyedOut
? theme.text.secondary
: theme.text.primary
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/ui/themes/no-color.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const noColorSemanticColors: SemanticColors = {
comment: '',
symbol: '',
dark: '',
focus: '',
gradient: [],
},
status: {
Expand Down
21 changes: 20 additions & 1 deletion packages/cli/src/ui/themes/semantic-tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { lightTheme, darkTheme } from './theme.js';
import { lightTheme, darkTheme, ansiTheme } from './theme.js';

export interface SemanticColors {
text: {
Expand All @@ -29,6 +29,7 @@ export interface SemanticColors {
comment: string;
symbol: string;
dark: string;
focus: string;
gradient: string[] | undefined;
};
status: {
Expand Down Expand Up @@ -61,6 +62,7 @@ export const lightSemanticColors: SemanticColors = {
comment: lightTheme.Comment,
symbol: lightTheme.Gray,
dark: lightTheme.DarkGray,
focus: lightTheme.AccentBlue,
gradient: lightTheme.GradientColors,
},
status: {
Expand Down Expand Up @@ -93,6 +95,7 @@ export const darkSemanticColors: SemanticColors = {
comment: darkTheme.Comment,
symbol: darkTheme.Gray,
dark: darkTheme.DarkGray,
focus: darkTheme.AccentBlue,
gradient: darkTheme.GradientColors,
},
status: {
Expand All @@ -101,3 +104,19 @@ export const darkSemanticColors: SemanticColors = {
warning: darkTheme.AccentYellow,
},
};

export const ansiSemanticColors: SemanticColors = {
...darkSemanticColors,
text: {
...darkSemanticColors.text,
primary: ansiTheme.Foreground,
},
background: {
...darkSemanticColors.background,
primary: ansiTheme.Background,
},
ui: {
...darkSemanticColors.ui,
comment: ansiTheme.Comment,
},
};
2 changes: 2 additions & 0 deletions packages/cli/src/ui/themes/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ export class Theme {
comment: this.colors.Gray,
symbol: this.colors.AccentCyan,
dark: this.colors.DarkGray,
focus: this.colors.AccentBlue,
gradient: this.colors.GradientColors,
},
status: {
Expand Down Expand Up @@ -419,6 +420,7 @@ export function createCustomTheme(customTheme: CustomTheme): Theme {
comment: customTheme.ui?.comment ?? colors.Comment,
symbol: customTheme.ui?.symbol ?? colors.Gray,
dark: colors.DarkGray,
focus: customTheme.ui?.focus ?? colors.AccentBlue,
gradient: customTheme.ui?.gradient ?? colors.GradientColors,
},
status: {
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ export interface CustomTheme {
ui?: {
comment?: string;
symbol?: string;
focus?: string;
gradient?: string[];
};
status?: {
Expand Down
Loading