Colors
Since 0.1.0-alpha.22Shades for tiers
When the series are in an order, such as plan tiers, set Palette to ChartPalette.Shades with one color, here the theme's primary. The first series is the lightest and each one after is darker.
Static
Preview
- Starter
- Pro
- Team
- Enterprise
| Month | Starter | Pro | Team | Enterprise |
|---|---|---|---|---|
| Jan | 1,020 | 610 | 220 | 38 |
| Feb | 1,065 | 642 | 231 | 40 |
| Mar | 1,110 | 688 | 249 | 43 |
| Apr | 1,142 | 715 | 262 | 45 |
| May | 1,198 | 760 | 280 | 49 |
| Jun | 1,236 | 798 | 301 | 52 |
Code
@* Paying subscribers each month by plan, tiers in order: shades of the primary color. *@
<Chart Items="_months" Argument="m => m.Month" Title="Subscribers by plan, 2026"
Stacking="ChartStacking.Normal" Palette="ChartPalette.Shades(Color.Primary)">
<ChartBarSeries Value="m => m.Starter" />
<ChartBarSeries Value="m => m.Pro" />
<ChartBarSeries Value="m => m.Team" />
<ChartBarSeries Value="m => m.Enterprise" />
</Chart>
{
private record MonthPlans(string Month, int Starter, int Pro, int Team, int Enterprise);
private readonly MonthPlans[] _months =
[
new("Jan", 1_020, 610, 220, 38),
new("Feb", 1_065, 642, 231, 40),
new("Mar", 1_110, 688, 249, 43),
new("Apr", 1_142, 715, 262, 45),
new("May", 1_198, 760, 280, 49),
new("Jun", 1_236, 798, 301, 52),
];
}In dark mode the ramp turns round, so the last series is the brightest. The shades are spread over as many series as the chart has. Past about six they're hard to tell apart; for series in no order, keep the default ChartPalette.Colors.
Diverging colors
For series on either side of a middle, such as answers from disagree to agree, set Palette to ChartPalette.Diverging with the two ends' colors.
Static
Preview
- Strongly disagree
- Disagree
- Neutral
- Agree
- Strongly agree
| Statement | Strongly disagree | Disagree | Neutral | Agree | Strongly agree |
|---|---|---|---|---|---|
| Setup was easy | 12 | 31 | 58 | 164 | 135 |
| The docs answered my question | 21 | 47 | 82 | 151 | 99 |
| Support replied quickly | 9 | 18 | 61 | 140 | 172 |
| I'd recommend it | 15 | 26 | 70 | 128 | 161 |
Code
@* A customer survey: each statement's answers as shares, from disagree to agree. *@
<Chart Items="_answers" Argument="a => a.Statement" Title="Customer survey, Q3"
Stacking="ChartStacking.Percent" Orientation="Orientation.Horizontal"
Palette="ChartPalette.Diverging(Color.Danger, Color.Success)">
<ChartBarSeries Value="a => a.StronglyDisagree" Name="Strongly disagree" />
<ChartBarSeries Value="a => a.Disagree" />
<ChartBarSeries Value="a => a.Neutral" />
<ChartBarSeries Value="a => a.Agree" />
<ChartBarSeries Value="a => a.StronglyAgree" Name="Strongly agree" />
</Chart>
{
private record Answers(string Statement, int StronglyDisagree, int Disagree, int Neutral, int Agree, int StronglyAgree);
private readonly Answers[] _answers =
[
new("Setup was easy", 12, 31, 58, 164, 135),
new("The docs answered my question", 21, 47, 82, 151, 99),
new("Support replied quickly", 9, 18, 61, 140, 172),
new("I'd recommend it", 15, 26, 70, 128, 161),
];
}The first series is the strongest of the first color and the last the strongest of the second. With an odd count, the middle one is gray.
ChartPalette.Of takes your own colors in order, and a series' Color still sets that one series.
One series picked out
When the chart makes a point about one series, such as one store against the rest, set Palette to ChartPalette.Emphasis with that series' index, from 0. It takes the theme palette's first color, or a color you pass, and every other series takes one gray.
Static
Preview
- Porto
- Madrid
- Seville
- Valencia
- Lisbon
| Month | Porto | Madrid | Seville | Valencia | Lisbon |
|---|---|---|---|---|---|
| Jan | 412 | 520 | 365 | 298 | 340 |
| Feb | 398 | 505 | 372 | 305 | 362 |
| Mar | 430 | 548 | 380 | 312 | 401 |
| Apr | 441 | 532 | 391 | 320 | 448 |
| May | 455 | 561 | 384 | 331 | 497 |
| Jun | 448 | 570 | 402 | 328 | 552 |
Code
@* Monthly orders at five stores: Lisbon, the one the page is about, in color, the others gray for context. *@
<Chart Items="_months" Argument="m => m.Month" Title="Orders by store, 2026" Palette="ChartPalette.Emphasis(4)">
<ChartLineSeries Value="m => m.Porto" Name="Porto" />
<ChartLineSeries Value="m => m.Madrid" Name="Madrid" />
<ChartLineSeries Value="m => m.Seville" Name="Seville" />
<ChartLineSeries Value="m => m.Valencia" Name="Valencia" />
<ChartLineSeries Value="m => m.Lisbon" Name="Lisbon" />
</Chart>
{
private record StoreMonth(string Month, int Porto, int Madrid, int Seville, int Valencia, int Lisbon);
private readonly StoreMonth[] _months =
[
new("Jan", 412, 520, 365, 298, 340),
new("Feb", 398, 505, 372, 305, 362),
new("Mar", 430, 548, 380, 312, 401),
new("Apr", 441, 532, 391, 320, 448),
new("May", 455, 561, 384, 331, 497),
new("Jun", 448, 570, 402, 328, 552),
];
}The gray keeps 3:1 contrast on the surface in both schemes, so the other series still read as data. They share it, so give every series a Name: the legend and tooltips tell them apart. Define the picked series last so its line is drawn over the grays.