or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

categorical.mddiverging.mdindex.mdsequential-multi.mdsequential-single.md
tile.json

categorical.mddocs/

Categorical Color Schemes

Categorical color schemes provide discrete colors for qualitative data visualization. These schemes are designed to be maximally distinguishable for representing distinct categories, making them ideal for pie charts, bar charts, and other visualizations where data points belong to separate groups.

Capabilities

Category10 Scheme

The default 10-color categorical scheme, commonly used in D3.js visualizations.

/**
 * Default 10-color categorical scheme
 * Colors: blue, orange, green, red, purple, brown, pink, gray, olive, cyan
 */
const schemeCategory10: string[];

Usage Examples:

import { schemeCategory10 } from "d3-scale-chromatic";
import { scaleOrdinal } from "d3-scale";

// Use with D3 ordinal scale
const colorScale = scaleOrdinal(schemeCategory10);
const colors = ["apple", "banana", "cherry"].map(colorScale);

// Direct array access
const firstColor = schemeCategory10[0]; // "#1f77b4" (blue)
const allColors = schemeCategory10; // Array of 10 colors

ColorBrewer Categorical Schemes

Professional categorical color schemes derived from Cynthia Brewer's ColorBrewer system.

/**
 * ColorBrewer Accent scheme - 8 qualitative colors
 * Bright, distinct colors suitable for highlighting
 */
const schemeAccent: string[];

/**
 * ColorBrewer Dark2 scheme - 8 qualitative colors  
 * Darker tones for better contrast on light backgrounds
 */
const schemeDark2: string[];

/**
 * ColorBrewer Paired scheme - 12 qualitative colors
 * Colors arranged in pairs of light/dark variants
 */
const schemePaired: string[];

/**
 * ColorBrewer Pastel1 scheme - 9 qualitative colors
 * Soft, light colors for subtle differentiation
 */
const schemePastel1: string[];

/**
 * ColorBrewer Pastel2 scheme - 8 qualitative colors
 * Alternative pastel color palette
 */
const schemePastel2: string[];

/**
 * ColorBrewer Set1 scheme - 9 qualitative colors
 * Bright, saturated colors for maximum distinction
 */
const schemeSet1: string[];

/**
 * ColorBrewer Set2 scheme - 8 qualitative colors
 * Medium saturation colors for balanced visibility
 */
const schemeSet2: string[];

/**
 * ColorBrewer Set3 scheme - 12 qualitative colors
 * Light, desaturated colors for subtle categorization
 */
const schemeSet3: string[];

Observable10 Scheme

Modern 10-color categorical scheme optimized for contemporary data visualization.

/**
 * Observable's 10-color categorical scheme
 * Contemporary colors optimized for modern visualizations
 */
const schemeObservable10: string[];

Tableau10 Scheme

Professional 10-color scheme from Tableau visualization software.

/**
 * Tableau's 10-color categorical scheme
 * Industry-standard colors used in business visualizations
 */
const schemeTableau10: string[];

Usage Patterns

With D3 Scales

import { schemeCategory10, schemeSet1 } from "d3-scale-chromatic";
import { scaleOrdinal } from "d3-scale";

// Basic ordinal scale
const colorScale = scaleOrdinal(schemeCategory10);

// Scale with explicit domain
const namedColorScale = scaleOrdinal(schemeSet1)
  .domain(["primary", "secondary", "tertiary"]);

// Using the scale
const primaryColor = namedColorScale("primary");

Direct Array Access

import { schemePaired, schemeAccent } from "d3-scale-chromatic";

// Get specific colors by index
const headerColor = schemePaired[0];
const accentColor = schemeAccent[2];

// Use entire array for mapping
const categoryColors = categories.map((_, i) => schemePaired[i % schemePaired.length]);

Scheme Selection

import { 
  schemeCategory10, 
  schemeSet1, 
  schemeDark2 
} from "d3-scale-chromatic";

// Choose scheme based on category count and design needs
function selectCategoricalScheme(categoryCount, theme = "default") {
  if (categoryCount <= 8 && theme === "dark") return schemeDark2;
  if (categoryCount <= 9 && theme === "bright") return schemeSet1;
  return schemeCategory10; // Default fallback
}

Color Counts and Characteristics

SchemeColor CountCharacteristics
schemeCategory1010Default D3 colors, balanced visibility
schemeObservable1010Modern, web-optimized colors
schemeTableau1010Professional business colors
schemeAccent8Bright highlighting colors
schemeDark28Dark colors for light backgrounds
schemePastel28Soft, subtle colors
schemeSet28Medium saturation, balanced
schemePastel19Light, gentle colors
schemeSet19Bright, highly saturated
schemePaired12Paired light/dark variants
schemeSet312Light, desaturated colors