From 00c3afe07680a3f2dc35301d289b61e6130fb813 Mon Sep 17 00:00:00 2001 From: Keith Guerin Date: Thu, 26 Feb 2026 13:39:25 -0800 Subject: [PATCH] feat(ui): move backgrounds to top and further refine /colors layout --- .../cli/src/ui/components/ColorsDisplay.tsx | 62 ++++++++++--------- 1 file changed, 34 insertions(+), 28 deletions(-) diff --git a/packages/cli/src/ui/components/ColorsDisplay.tsx b/packages/cli/src/ui/components/ColorsDisplay.tsx index 08a36f56a7..b08cf97e09 100644 --- a/packages/cli/src/ui/components/ColorsDisplay.tsx +++ b/packages/cli/src/ui/components/ColorsDisplay.tsx @@ -53,24 +53,28 @@ interface BackgroundColorRow { type ColorRow = StandardColorRow | GradientColorRow | BackgroundColorRow; +const VALUE_COLUMN_WIDTH = '12%'; +const NAME_COLUMN_WIDTH = '30%'; + export const ColorsDisplay: React.FC = () => { const semanticColors = themeManager.getSemanticColors(); const activeTheme = themeManager.getActiveTheme(); - const allRows: ColorRow[] = []; - const gradientRow: GradientColorRow | null = - semanticColors.ui.gradient && semanticColors.ui.gradient.length > 0 - ? { - type: 'gradient', - name: 'ui.gradient', - value: semanticColors.ui.gradient, - } - : null; + const backgroundRows: BackgroundColorRow[] = []; + const standardRows: StandardColorRow[] = []; + let gradientRow: GradientColorRow | null = null; + + if (semanticColors.ui.gradient && semanticColors.ui.gradient.length > 0) { + gradientRow = { + type: 'gradient', + name: 'ui.gradient', + value: semanticColors.ui.gradient, + }; + } // Flatten and categorize the SemanticColors object for (const [category, subColors] of Object.entries(semanticColors)) { if (category === 'ui' && 'gradient' in subColors) { - // Handled separately or later continue; } @@ -85,13 +89,13 @@ export const ColorsDisplay: React.FC = () => { for (const [diffName, diffValue] of Object.entries(value)) { if (typeof diffValue === 'string') { if (category === 'background') { - allRows.push({ + backgroundRows.push({ type: 'background', name: `${fullName}.${diffName}`, value: diffValue, }); } else { - allRows.push({ + standardRows.push({ type: 'standard', name: `${fullName}.${diffName}`, value: diffValue, @@ -101,13 +105,13 @@ export const ColorsDisplay: React.FC = () => { } } else if (typeof value === 'string') { if (category === 'background') { - allRows.push({ + backgroundRows.push({ type: 'background', name: fullName, value, }); } else { - allRows.push({ + standardRows.push({ type: 'standard', name: fullName, value, @@ -117,10 +121,12 @@ export const ColorsDisplay: React.FC = () => { } } - // Add gradient row if it exists - if (gradientRow) { - allRows.push(gradientRow); - } + // Final order: Backgrounds first, then Standards, then Gradient + const allRows: ColorRow[] = [ + ...backgroundRows, + ...standardRows, + ...(gradientRow ? [gradientRow] : []), + ]; return ( @@ -153,12 +159,12 @@ export const ColorsDisplay: React.FC = () => { borderColor={theme.border.default} paddingX={1} > - + Value - + Name @@ -190,10 +196,10 @@ function renderStandardRow({ name, value }: StandardColorRow) { return ( - + {value || '(blank)'} - + {name} @@ -208,14 +214,14 @@ function renderGradientRow({ name, value }: GradientColorRow) { return ( - + {value.map((c, i) => ( {c} ))} - + {name} @@ -231,9 +237,9 @@ function renderBackgroundRow({ name, value }: BackgroundColorRow) { const description = COLOR_DESCRIPTIONS[name] || ''; return ( - + - - {name} + + {name} {description}