Named themes
A named theme restyles a whole chart from one word: theme: "nyt". There are twenty. Fourteen are the house styles of Flint, Microsoft's chart grammar, transcribed from its presets. default, survey, surveyBlocks, surveyLines, dark and dd are Elicit.js's own. The three survey themes also set the design the widgets are drawn in. Each is a partial theme, so a chart can start from one and change any token.
Using a named theme
Pass the name as theme, or the object from themes. theme: "nyt" and theme: themes.nyt are the same. setTheme("nyt") makes it the default for every chart built afterwards.
A named theme sets the surface, the ink and palettes, the fonts of the labels and the title, which axes draw a spine and ticks, which get gridlines, the zero line, the band padding, corner radii, line widths, point size, and the colour of the hover and selection outline. Anything you place yourself stays where you put it.
theme: "nyt"
A serif headline over sans-serif labels, no value-axis spine, a quiet grid and a rule at zero.
// A built-in theme by NAME. `theme: themes.nyt` is the same thing.const chart = Elicit({width: 480, height: 300,theme: "nyt",title: "Where will unemployment go next?",subtitle: "Rate, %. Drag the dots after 2024 to your forecast.",caption: "Up to 2024 is observed; the rest is yours.",context: (d) => d.year <= 2024,data: [{ year: 2020, rate: 8.1 }, { year: 2021, rate: 5.4 }, { year: 2022, rate: 3.6 },],schema: {year: { type: "quantitative", domain: [2020, 2027] },rate: { type: "quantitative", domain: [0, 10] },},// Ticks clear of the corner, where the two axes' end labels would meet.axes: { x: { tickFormat: "d", tickValues: [2021, 2023, 2025, 2027] } },marks: [lineY({ channels: { x: { field: "year" }, y: { field: "rate" } } }),point({ channels: { x: { field: "year" }, y: { field: "rate", edit: move() } } }),],});mount(chart.dom());
Newsroom
nyt, economist, bbc and datawrapper are editorial styles. They drop the value-axis spine and ticks, keep a light value grid, and draw a rule at zero. nyt sets its headline in Georgia. economist uses a blue-grey grid and tighter bars. bbc uses large type, a four-colour palette and a heavy zero rule. datawrapper uses Roboto and a light solid grid.
nyt · economist · bbc · datawrapper
The same grouped bar chart under each newsroom theme.
// One chart, drawn under each theme. Only `theme` changes.const chart = (theme) => Elicit({width: 320, height: 240, theme,title: theme,subtitle: "Chance of each outcome, %",data: [{ outcome: "Rain", who: "You", p: 40 }, { outcome: "Rain", who: "Experts", p: 55 },],schema: {outcome: { type: "categorical", domain: ["Rain", "Sun", "Snow"] },who: { type: "categorical", domain: ["You", "Experts"] },p: { type: "quantitative", domain: [0, 60] },},marks: [barY({channels: {x: { field: "outcome" }, xOffset: { field: "who" },y: { field: "p", edit: move() },fill: { field: "who", legend: { anchor: "top", title: false } },},}),],});const row = document.createElement("div");row.style.cssText = "display:flex;flex-wrap:wrap;gap:20px;max-width:680px";for (const name of ["nyt", "economist", "bbc", "datawrapper"]) row.append(chart(name).dom());mount(row);
Print and science
swiss is the International Typographic Style: warm paper, black spines, short outward ticks on the value axis, one signal red. nature is the journal figure: black Arial, full spines with long ticks, no gridlines, and the Okabe–Ito colours. deStijl uses red, yellow and blue on off-white, heavy black value gridlines, and an italic Futura title.
swiss · nature · deStijl
Typographic, scientific and Neo-Plastic.
// One chart, drawn under each theme. Only `theme` changes.const chart = (theme) => Elicit({width: 320, height: 240, theme,title: theme,subtitle: "Chance of each outcome, %",data: [{ outcome: "Rain", who: "You", p: 40 }, { outcome: "Rain", who: "Experts", p: 55 },],schema: {outcome: { type: "categorical", domain: ["Rain", "Sun", "Snow"] },who: { type: "categorical", domain: ["You", "Experts"] },p: { type: "quantitative", domain: [0, 60] },},marks: [barY({channels: {x: { field: "outcome" }, xOffset: { field: "who" },y: { field: "p", edit: move() },fill: { field: "who", legend: { anchor: "top", title: false } },},}),],});const row = document.createElement("div");row.style.cssText = "display:flex;flex-wrap:wrap;gap:20px;max-width:680px";for (const name of ["swiss", "nature", "deStijl"]) row.append(chart(name).dom());mount(row);
Business
mckinsey draws no axes and no gridlines, a near-black primary over electric blues, and a baseline. powerbiLight and powerbi are the dashboard tile on a white and a near-black canvas: Segoe UI, a quiet grid, bars rounded by 3px. The dark tile's sequential ramp runs from dim to bright, so a higher value is brighter.
mckinsey · powerbiLight · powerbi
Consulting deck and dashboard tiles.
// One chart, drawn under each theme. Only `theme` changes.const chart = (theme) => Elicit({width: 320, height: 240, theme,title: theme,subtitle: "Chance of each outcome, %",data: [{ outcome: "Rain", who: "You", p: 40 }, { outcome: "Rain", who: "Experts", p: 55 },],schema: {outcome: { type: "categorical", domain: ["Rain", "Sun", "Snow"] },who: { type: "categorical", domain: ["You", "Experts"] },p: { type: "quantitative", domain: [0, 60] },},marks: [barY({channels: {x: { field: "outcome" }, xOffset: { field: "who" },y: { field: "p", edit: move() },fill: { field: "who", legend: { anchor: "top", title: false } },},}),],});const row = document.createElement("div");row.style.cssText = "display:flex;flex-wrap:wrap;gap:20px;max-width:680px";for (const name of ["mckinsey", "powerbiLight", "powerbi"]) row.append(chart(name).dom());mount(row);
Product interfaces
apple uses the system colours, no spines or ticks, a hairline grid and bars rounded by 4px. material is Material Design 3: a purple-led tonal palette, Google Sans and Roboto, outline-variant gridlines, rounded bars and round legend chips.
apple · material
Quiet app-interface charts.
// One chart, drawn under each theme. Only `theme` changes.const chart = (theme) => Elicit({width: 320, height: 240, theme,title: theme,subtitle: "Chance of each outcome, %",data: [{ outcome: "Rain", who: "You", p: 40 }, { outcome: "Rain", who: "Experts", p: 55 },],schema: {outcome: { type: "categorical", domain: ["Rain", "Sun", "Snow"] },who: { type: "categorical", domain: ["You", "Experts"] },p: { type: "quantitative", domain: [0, 60] },},marks: [barY({channels: {x: { field: "outcome" }, xOffset: { field: "who" },y: { field: "p", edit: move() },fill: { field: "who", legend: { anchor: "top", title: false } },},}),],});const row = document.createElement("div");row.style.cssText = "display:flex;flex-wrap:wrap;gap:20px;max-width:680px";for (const name of ["apple", "material"]) row.append(chart(name).dom());mount(row);
Playful
pop extends swiss: process colours on yellow, heavy black spines, thick outlines on every filled mark, oversized points and Arial Black. cartoon uses cream paper, a comic typeface, dark outlines, rounded bars, chunky lines and a dashed grid.
pop · cartoon
Heavy outlines and loud colour.
// One chart, drawn under each theme. Only `theme` changes.const chart = (theme) => Elicit({width: 320, height: 240, theme,title: theme,subtitle: "Chance of each outcome, %",data: [{ outcome: "Rain", who: "You", p: 40 }, { outcome: "Rain", who: "Experts", p: 55 },],schema: {outcome: { type: "categorical", domain: ["Rain", "Sun", "Snow"] },who: { type: "categorical", domain: ["You", "Experts"] },p: { type: "quantitative", domain: [0, 60] },},marks: [barY({channels: {x: { field: "outcome" }, xOffset: { field: "who" },y: { field: "p", edit: move() },fill: { field: "who", legend: { anchor: "top", title: false } },},}),],});const row = document.createElement("div");row.style.cssText = "display:flex;flex-wrap:wrap;gap:20px;max-width:680px";for (const name of ["pop", "cartoon"]) row.append(chart(name).dom());mount(row);
Elicit.js's own
default is the built-in look. survey restyles the survey widgets with an indigo accent and Inter. dark paints its own slate surface, so it reads on a dark page with no host CSS. dd is the Data & Dialogue Lab theme: the lab's teal as the ink, its blue for handles and answers, then coral, gold, violet, leaf and rose for categories. Shapes carry no stroke, and a stroke that does appear is the same hue a step darker. Every chart on this site is drawn with it.
The palette is also available as colour schemes: scheme: "dd" for categories, "ddramp" for a sequential channel and "dddiverging" for a diverging one.
dd · survey · dark
Elicit.js's own looks, side by side.
// One chart, drawn under each theme. Only `theme` changes.const chart = (name) => Elicit({width: 320, height: 240,// The dark surface needs light categories; the others keep the site palette.theme: name === "dark" ? { extends: "dark", palette: ["#50AEB7", "#F2B94B"] } : name,title: name,subtitle: "Chance of each outcome, %",data: [{ outcome: "Rain", who: "You", p: 40 }, { outcome: "Rain", who: "Experts", p: 55 },],schema: {outcome: { type: "categorical", domain: ["Rain", "Sun", "Snow"] },who: { type: "categorical", domain: ["You", "Experts"] },p: { type: "quantitative", domain: [0, 60] },},marks: [barY({channels: {x: { field: "outcome" }, xOffset: { field: "who" },y: { field: "p", edit: move() },fill: { field: "who", legend: { anchor: "top", title: false } },},}),],});const row = document.createElement("div");row.style.cssText = "display:flex;flex-wrap:wrap;gap:20px;max-width:680px";for (const name of ["dd", "survey", "dark"]) row.append(chart(name).dom());mount(row);
Extending a theme
extends starts a partial theme from a named one, and the rest of the object deep-merges over it. The name comes from Flint. Use it to keep a house style and change its colour, a radius or a font.
{ extends: "swiss", … }
Swiss, with a blue ink, rounded bars and an italic title.
// Start from a named theme and change what you need. `extends` names the base;// the rest deep-merges over it.const chart = Elicit({width: 420, height: 260,theme: {extends: "swiss",ink: "#2B5D87", // Swiss blue instead of signal redmarks: { bar: { cornerRadius: 2 } },title: { fontStyle: "italic" },},title: "Budget split",subtitle: "Drag each bar to your estimate, %",data: [{ line: "Staff", v: 45 }, { line: "Rent", v: 25 }, { line: "Tools", v: 30 }],schema: {line: { type: "categorical", domain: ["Staff", "Rent", "Tools"] },v: { type: "quantitative", domain: [0, 60] },},marks: [barY({ channels: { x: { field: "line" }, y: { field: "v", edit: move() } } })],});mount(chart.dom());
What carries over from Flint
Each preset keeps Flint's colours, font stacks, weights and proportions. Flint's bandFraction becomes bandPadding (one minus it), a point's area becomes a radius, and its presence words become tokens: omit turns a spine off or sets tickSize: 0, and a value-axis grid becomes grid.show: "continuous". Flint names type sizes with tokens (text.100 to text.500), which these themes set as 11 to 24 px.
Some parts of a Flint theme are layout, which Elicit.js leaves to the spec: data labels on marks, series names at line ends, a value axis on the right, and furniture such as The Economist's red tab or the BBC's footer rule. Draw those with marks and guides where you need them.
Flint is MIT-licensed. Its theme specification is at docs/theme-spec.md, and its theme gallery at microsoft.github.io/flint-chart.