feat(ui): Semantic tokens refactor (#8087)

This commit is contained in:
Miguel Solorio
2025-09-10 10:57:07 -07:00
committed by GitHub
parent a3a0e981ee
commit b9b6fe1f73
57 changed files with 509 additions and 424 deletions
@@ -7,7 +7,7 @@
import React, { Fragment, useEffect, useId } from 'react';
import { Box, Text } from 'ink';
import stringWidth from 'string-width';
import { Colors } from '../../colors.js';
import { theme } from '../../semantic-colors.js';
import { toCodePoints } from '../../utils/textUtils.js';
import { useOverflowActions } from '../../contexts/OverflowContext.js';
@@ -186,14 +186,14 @@ export const MaxSizedBox: React.FC<MaxSizedBoxProps> = ({
return (
<Box flexDirection="column" width={maxWidth} flexShrink={0}>
{totalHiddenLines > 0 && overflowDirection === 'top' && (
<Text color={Colors.Gray} wrap="truncate">
<Text color={theme.text.secondary} wrap="truncate">
... first {totalHiddenLines} line{totalHiddenLines === 1 ? '' : 's'}{' '}
hidden ...
</Text>
)}
{visibleLines}
{totalHiddenLines > 0 && overflowDirection === 'bottom' && (
<Text color={Colors.Gray} wrap="truncate">
<Text color={theme.text.secondary} wrap="truncate">
... last {totalHiddenLines} line{totalHiddenLines === 1 ? '' : 's'}{' '}
hidden ...
</Text>
@@ -7,7 +7,7 @@
import type React from 'react';
import { useEffect, useState, useRef } from 'react';
import { Text, Box } from 'ink';
import { Colors } from '../../colors.js';
import { theme } from '../../semantic-colors.js';
import { useKeypress } from '../../hooks/useKeypress.js';
/**
@@ -164,7 +164,9 @@ export function RadioButtonSelect<T>({
return (
<Box flexDirection="column">
{showScrollArrows && (
<Text color={scrollOffset > 0 ? Colors.Foreground : Colors.Gray}>
<Text
color={scrollOffset > 0 ? theme.text.primary : theme.text.secondary}
>
</Text>
)}
@@ -172,18 +174,18 @@ export function RadioButtonSelect<T>({
const itemIndex = scrollOffset + index;
const isSelected = activeIndex === itemIndex;
let textColor = Colors.Foreground;
let numberColor = Colors.Foreground;
let textColor = theme.text.primary;
let numberColor = theme.text.primary;
if (isSelected) {
textColor = Colors.AccentGreen;
numberColor = Colors.AccentGreen;
textColor = theme.status.success;
numberColor = theme.status.success;
} else if (item.disabled) {
textColor = Colors.Gray;
numberColor = Colors.Gray;
textColor = theme.text.secondary;
numberColor = theme.text.secondary;
}
if (!showNumbers) {
numberColor = Colors.Gray;
numberColor = theme.text.secondary;
}
const numberColumnWidth = String(items.length).length;
@@ -195,7 +197,7 @@ export function RadioButtonSelect<T>({
<Box key={item.label} alignItems="center">
<Box minWidth={2} flexShrink={0}>
<Text
color={isSelected ? Colors.AccentGreen : Colors.Foreground}
color={isSelected ? theme.status.success : theme.text.primary}
aria-hidden
>
{isSelected ? '●' : ' '}
@@ -212,7 +214,9 @@ export function RadioButtonSelect<T>({
{item.themeNameDisplay && item.themeTypeDisplay ? (
<Text color={textColor} wrap="truncate">
{item.themeNameDisplay}{' '}
<Text color={Colors.Gray}>{item.themeTypeDisplay}</Text>
<Text color={theme.text.secondary}>
{item.themeTypeDisplay}
</Text>
</Text>
) : (
<Text color={textColor} wrap="truncate">
@@ -226,8 +230,8 @@ export function RadioButtonSelect<T>({
<Text
color={
scrollOffset + maxItemsToShow < items.length
? Colors.Foreground
: Colors.Gray
? theme.text.primary
: theme.text.secondary
}
>