Skip to content

Commit ef78d22

Browse files
fix(usage): centralize chart palette tokens
1 parent e2cdee6 commit ef78d22

4 files changed

Lines changed: 16 additions & 21 deletions

File tree

‎apps/sim/app/_styles/globals.css‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,13 @@ html[data-sim-desktop-title-bar="inset"]
742742
--selection-muted: #1a5cf647;
743743
--warning: #ea580c;
744744

745+
/* Organization usage chart fills, shared by bars, legends, and tooltips. */
746+
--usage-chat: #1f9d63;
747+
--usage-enrichment: #c026d3;
748+
--usage-knowledge: #0e9f9f;
749+
--usage-agent: var(--brand-agent);
750+
--usage-other: var(--text-secondary);
751+
745752
/* Inverted surface (dark chrome on light page, e.g. tag dropdown) */
746753
--surface-inverted: #1b1b1b;
747754
--surface-inverted-hover: #363636;
@@ -905,6 +912,12 @@ html[data-sim-desktop-title-bar="inset"]
905912
--selection-muted: #4b83f759;
906913
--warning: #ff6600;
907914

915+
/* Dark chart fills keep their existing contrast on dark surfaces. */
916+
--usage-chat: var(--brand-accent-hover);
917+
--usage-enrichment: #d946ef;
918+
--usage-agent: var(--color-violet-500);
919+
--usage-other: #8a8a8a;
920+
908921
/* Inverted surface (in dark mode, falls back to standard surfaces) */
909922
--surface-inverted: #242424;
910923
--surface-inverted-hover: #363636;

‎apps/sim/ee/organization-usage/components/activity-summary.tsx‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,12 @@ import {
77
ChartFrame,
88
ChartLegend,
99
type ChartLegendItem,
10-
cn,
1110
DashboardMetric,
1211
formatChartLatency,
1312
} from '@sim/emcn'
1413
import type { OrganizationActivitySummary } from '@/lib/api/contracts/organization-activity'
1514
import { SettingsSection } from '@/app/workspace/[workspaceId]/settings/components/settings-section/settings-section'
16-
import {
17-
USAGE_CHAT_COLOR,
18-
USAGE_OTHER_COLOR,
19-
USAGE_PALETTE_CLASS,
20-
} from '@/ee/organization-usage/constants'
15+
import { USAGE_CHAT_COLOR, USAGE_OTHER_COLOR } from '@/ee/organization-usage/constants'
2116
import { useLegendHighlight } from '@/ee/organization-usage/hooks/use-legend-highlight'
2217
import { useOrganizationActivitySummary } from '@/hooks/queries/organization-activity'
2318
import type { OrganizationUsageWindowKey } from '@/hooks/queries/utils/organization-usage-keys'
@@ -119,7 +114,7 @@ export function ActivitySummary({ summary, loading, error, onRetry }: ActivitySu
119114
const chartState = { loading, error: error ? "Couldn't load activity." : undefined, onRetry }
120115

121116
return (
122-
<div className={cn('flex flex-col gap-5', USAGE_PALETTE_CLASS)}>
117+
<div className='flex flex-col gap-5'>
123118
<div className='grid grid-cols-[repeat(auto-fit,minmax(min(120px,100%),1fr))] gap-4'>
124119
{metrics.map((metric) => (
125120
<DashboardMetric

‎apps/sim/ee/organization-usage/components/usage-credits.tsx‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
} from '@sim/emcn'
1414
import type { OrganizationUsageOverview } from '@/lib/api/contracts/organization-usage'
1515
import {
16-
USAGE_PALETTE_CLASS,
1716
USAGE_SOURCE_CATEGORIES,
1817
USAGE_SOURCE_CATEGORY,
1918
type UsageSourceCategoryId,
@@ -111,9 +110,7 @@ export function UsageCredits({
111110
const highlight = useLegendHighlight(legend.map((item) => item.id))
112111

113112
return (
114-
<div
115-
className={cn('flex flex-col gap-4', USAGE_PALETTE_CLASS, isPlaceholderData && 'opacity-50')}
116-
>
113+
<div className={cn('flex flex-col gap-4', isPlaceholderData && 'opacity-50')}>
117114
<div className='flex flex-col gap-1.5'>
118115
<div className='flex h-7 items-baseline gap-2 whitespace-nowrap'>
119116
<span className='text-[var(--text-body)] text-lg tabular-nums'>

‎apps/sim/ee/organization-usage/constants.ts‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,6 @@ export const EXPANDED_ROW_COUNT = ORGANIZATION_USAGE_BREAKDOWN_MAX_LIMIT
9595
export const DEFAULT_USAGE_PRESET = '30d' as const
9696
export const DEFAULT_USAGE_TAB = USAGE_OVERVIEW_TAB
9797

98-
/**
99-
* The Insights chart palette, declared on each chart's root so a layer, its legend
100-
* dot, and its tooltip swatch resolve to one color. Each hue is its source's color
101-
* elsewhere in the app — Sim green for Chat, the Enrichment block's purple, the
102-
* Knowledge block's teal, the agent violet — stepped to the lightness a filled mark
103-
* needs in each mode; badge text tokens are too pale in dark mode to fill a bar.
104-
*/
105-
export const USAGE_PALETTE_CLASS =
106-
'[--usage-chat:#1f9d63] [--usage-enrichment:#c026d3] [--usage-knowledge:#0e9f9f] [--usage-agent:#6f3dfa] [--usage-other:var(--text-secondary)] dark:[--usage-chat:#2dac72] dark:[--usage-enrichment:#d946ef] dark:[--usage-agent:#8b5cf6] dark:[--usage-other:#8a8a8a]'
107-
10898
/** Sim Chat's color, shared by its credit layer and the chat-runs chart. */
10999
export const USAGE_CHAT_COLOR = 'var(--usage-chat)'
110100

0 commit comments

Comments
 (0)