diff --git a/packages/docs/src/benchmarks/shared/InteractionBreakdownChart.astro b/packages/docs/src/benchmarks/shared/InteractionBreakdownChart.astro
index 384836fb..7ef23f1f 100644
--- a/packages/docs/src/benchmarks/shared/InteractionBreakdownChart.astro
+++ b/packages/docs/src/benchmarks/shared/InteractionBreakdownChart.astro
@@ -3,6 +3,7 @@ import { prepareInteractionBreakdownTable } from '../../lib/prepare-table'
import StatsTable from '../../components/StatsTable.astro'
import ViewSwitcher from '../../components/ViewSwitcher.astro'
import { INTERACTION_PHASES } from '../../lib/interaction-phases'
+import { stackLegendSwatch } from '../../lib/chart-styles'
import InteractionChartCaption from './InteractionChartCaption.astro'
import StackedBarChart from '../../components/StackedBarChart.astro'
@@ -37,7 +38,11 @@ const chart1Table = prepareInteractionBreakdownTable(chart1)
defaultValue="chart"
>
-
+ stackLegendSwatch(index, count)}
+ outlined
+ />
diff --git a/packages/docs/src/benchmarks/shared/InteractionChartCaption.astro b/packages/docs/src/benchmarks/shared/InteractionChartCaption.astro
index a3d891bb..cda99be7 100644
--- a/packages/docs/src/benchmarks/shared/InteractionChartCaption.astro
+++ b/packages/docs/src/benchmarks/shared/InteractionChartCaption.astro
@@ -1,11 +1,23 @@
---
import { INTERACTION_PHASES } from '../../lib/interaction-phases'
+type InteractionPhase = (typeof INTERACTION_PHASES)[number]
+
interface Props {
title?: string
+ swatchColor?: (
+ phase: InteractionPhase,
+ index: number,
+ count: number,
+ ) => string
+ outlined?: boolean
}
-const { title } = Astro.props
+const {
+ title,
+ swatchColor = (phase: InteractionPhase) => phase.color,
+ outlined = false,
+} = Astro.props
---
@@ -25,10 +37,13 @@ const { title } = Astro.props
{
- INTERACTION_PHASES.map(({ label, color }) => (
+ INTERACTION_PHASES.map((phase, index) => (
-
-
- {label}
+
+ {phase.label}
))
}
@@ -80,4 +95,8 @@ const { title } = Astro.props
height: 0.75rem;
border-radius: 0.2rem;
}
+
+ .swatch.outlined {
+ border: 1px solid var(--ft-muted);
+ }
diff --git a/packages/docs/src/components/ComparisonBarChart.astro b/packages/docs/src/components/ComparisonBarChart.astro
index 5cc2a3a1..fd00bd91 100644
--- a/packages/docs/src/components/ComparisonBarChart.astro
+++ b/packages/docs/src/components/ComparisonBarChart.astro
@@ -142,7 +142,16 @@ const chartPayload = JSON.stringify({
formatValue,
getFrameworkLogoSource,
} from '../lib/chart'
- import { highlightedGray, primaryGray } from '../lib/chart-styles'
+ import {
+ BAR_FILL_OPACITY,
+ BAR_FOCUS_FILL_OPACITY,
+ BAR_STROKE_WIDTH,
+ primaryGray,
+ } from '../lib/chart-styles'
+ import {
+ getBrandByDisplayName,
+ resolveBrandColor,
+ } from '../lib/framework-logos'
import type { ChartDatum, ComparisonChartPayload } from '../lib/types'
type Payload = ComparisonChartPayload & {
@@ -254,6 +263,17 @@ const chartPayload = JSON.stringify({
const mutedColor = getCssVar('--ft-muted', '#697586')
const names = rows.map((d) => d.name)
+ const theme = document.documentElement.dataset.theme
+ const barColors = new Map(
+ rows.map((d) => {
+ const brand = getBrandByDisplayName(d.name)
+ return [
+ d.name,
+ brand ? resolveBrandColor(brand.color, theme) : primaryGray,
+ ] as const
+ }),
+ )
+ const barColor = (d: ChartDatum) => barColors.get(d.name) ?? primaryGray
const logoLayer = renderLogoLayer(wrapper, names)
const definition = defineChart({
@@ -306,13 +326,16 @@ const chartPayload = JSON.stringify({
id: 'values',
x: 'value',
y: 'name',
- fill: primaryGray,
+ fill: barColor,
+ fillOpacity: BAR_FILL_OPACITY,
+ stroke: barColor,
+ strokeWidth: BAR_STROKE_WIDTH,
radius: 8,
inset: SHARED_BAR_INSET,
states: [
{
when: { focus: 'primary' },
- style: { fill: highlightedGray },
+ style: { fillOpacity: BAR_FOCUS_FILL_OPACITY },
transition: {
type: 'tween',
duration: 140,
diff --git a/packages/docs/src/components/StackedBarChart.astro b/packages/docs/src/components/StackedBarChart.astro
index dbbc8d16..98e28da6 100644
--- a/packages/docs/src/components/StackedBarChart.astro
+++ b/packages/docs/src/components/StackedBarChart.astro
@@ -1,5 +1,6 @@
---
import { SHARED_CHART_HEIGHT, formatValue } from '../lib/chart'
+import { stackLegendSwatch } from '../lib/chart-styles'
import type { ChartValueFormat } from '../lib/types'
interface Series {
key: string
@@ -24,9 +25,11 @@ const { title, series, data, valueFormat = 'kb' } = Astro.props
{
!Astro.slots.has('caption') && (
- {series.map((item) => (
+ {series.map((item, index) => (
-
-
+
{item.label}
))}
@@ -114,7 +117,7 @@ const { title, series, data, valueFormat = 'kb' } = Astro.props
width: 0.8rem;
height: 0.8rem;
border-radius: 2px;
- border: 1px solid var(--ft-border);
+ border: 1px solid var(--ft-muted);
}