diff --git a/docs/configuration-customizations.md b/docs/configuration-customizations.md index 21c92c6ae..0fb8d3c75 100644 --- a/docs/configuration-customizations.md +++ b/docs/configuration-customizations.md @@ -45,18 +45,18 @@ For example, we can override main color and use [Tableu10](https://www.tableau.c ```yaml customizaiton: visualizationColors: - main: #829aa3 + main: "#829aa3" series: - - #4e79a7 - - #f28e2c - - #e15759 - - #76b7b2 - - #59a14f - - #edc949 - - #af7aa1 - - #ff9da7 - - #9c755f - - #bab0ab + - "#4e79a7" + - "#f28e2c" + - "#e15759" + - "#76b7b2" + - "#59a14f" + - "#edc949" + - "#af7aa1" + - "#ff9da7" + - "#9c755f" + - "#bab0ab" ``` By default, Turnilo uses 10 different colors for series. But it is possible to define more and Turnilo will adjust necessary split limits. diff --git a/src/common/utils/rules/split-adjustments.ts b/src/common/utils/rules/split-adjustments.ts index 06a43100f..bf17b58a1 100644 --- a/src/common/utils/rules/split-adjustments.ts +++ b/src/common/utils/rules/split-adjustments.ts @@ -23,11 +23,16 @@ import { thread } from "../functional/functional"; export function adjustColorSplit(split: Split, dimension: Dimension, series: SeriesList, visualizationColors: VisualizationColors): Split { const colorsCount = visualizationColors.series.length; + const availableLimits = new Set([ + // TODO: This magic 5 will disappear in #756 + 5, + Math.min(split.limit, colorsCount), + colorsCount + ]); return thread( split, adjustSort(dimension, series), - // TODO: This magic 5 will disappear in #756 - adjustFiniteLimit([5, colorsCount], colorsCount) + adjustFiniteLimit([...availableLimits], colorsCount) ); }