Skip to content

Theme builder ​

Pick a few colors and the rest are worked out for you. Download the theme as a file and use it right away. Everything is calculated in this browser, and nothing is sent to a server.

Preview

Checks that this theme looks the same when the site is in dark mode.

While this is off, Tab enters the grid and moves through its cells, skipping the filter inputs and buttons. Turn it on to stop on those too.

Skip the preview grid

Contrast check

All text and marks meet the required ratios.

Presets

Only the inputs change. You can undo right away.

Make a theme from a picture

Pick the main colours of one picture and use them as accent, background, surface and text. The picture is read in this browser only and never sent to a server.

You can also drop a picture here or paste it with Ctrl+V. (PNG, JPEG, WebP, GIF, AVIF, SVG, up to 10 MB)

Import design tokens

Paste or load W3C design tokens JSON, Tokens Studio JSON or CSS custom properties (--name: #colour;). Colours exported from a design tool can be used as they are.

Name and base

Start with a lowercase letter, then lowercase letters, digits or hyphens, up to 32 characters. It becomes the file name and the data-mxg-theme value.

Base

The brightness used when the other colors are worked out.

Colors

Grid background
Body text color
Check marks, focus ring, sort arrows
Lines between rows and cells
Background of the top row
Background of selected rows
Error cells and warnings

Font and shape

Separate several with commas. Put names that contain spaces in quotes.

Density

When set, this wins over the density option of the grid.

Download

maxgrid-theme-my-theme.css
/*
 * MaxGrid theme "my-theme"
 * 1) Load this file after the grid CSS: <link rel="stylesheet" href="…">
 * 2) Put data-mxg-theme="my-theme" on the grid or any ancestor element.
 * 3) To use it on one area only, put it on that area. It wins over the site light/dark setting.
 */
.mxg[data-mxg-theme='my-theme'][data-mxg-theme='my-theme'][data-mxg-theme='my-theme'],
.mxg-controls[data-mxg-theme='my-theme'][data-mxg-theme='my-theme'][data-mxg-theme='my-theme'] {
  --mxg-bg: #ffffff;
  --mxg-fg: #1f2933;
  --mxg-accent: #1a56c4;
  --mxg-border: #d9dee5;
  --mxg-bg-header: #f3f5f8;
  --mxg-bg-selected: #dbe7fb;
  --mxg-danger: #b42318;
  --mxg-mark-dirty: #9a6700;
  --mxg-mark-added: #1a7f37;
  --mxg-fg-muted: #5e656c;
  --mxg-fg-disabled: #9a9fa3;
  --mxg-bg-row-hover: #e8eef9;
  --mxg-bg-row-stripe: #f6f6f7;
  --mxg-border-strong: #84898f;
  --mxg-guide-color: #84898f;
  --mxg-bg-selected-hover: #c8d9f6;
  --mxg-bg-dirty: #f0e8d9;
  --mxg-bg-added: #ddece1;
  --mxg-bg-invalid: #f6e5e3;
  --mxg-bg-find-hit: #efe7d6;
  --mxg-bg-find-active: #e1d1b3;
  --mxg-bg-disabled: #f4f4f5;
  --mxg-control-border: #676d74;
  --mxg-control-border-hover: #414952;
  --mxg-control-bg-active: #e4e5e7;
  --mxg-tone-track: #e4e5e7;
  --mxg-tone-neutral-bg: #edeeef;
  --mxg-tone-neutral-fg: #353e47;
  --mxg-tone-neutral-bar: #676d74;
  --mxg-tone-info-bg: #dfe7f7;
  --mxg-tone-info-fg: #1e3250;
  --mxg-tone-success-bg: #dfede3;
  --mxg-tone-success-fg: #1e3a34;
  --mxg-tone-warning-bg: #f1eadb;
  --mxg-tone-warning-fg: #383529;
  --mxg-tone-danger-bg: #f5e0df;
  --mxg-tone-danger-fg: #3d282e;
  --mxg-fg-header: var(--mxg-fg);
  --mxg-fg-selected: var(--mxg-fg);
  --mxg-focus-ring: var(--mxg-accent);
  --mxg-sort-indicator: var(--mxg-accent);
  --mxg-resize-handle: var(--mxg-border-strong);
  --mxg-border-find-hit: var(--mxg-mark-dirty);
  --mxg-border-find-active: var(--mxg-mark-dirty);
  --mxg-tone-info-bar: var(--mxg-accent);
  --mxg-tone-success-bar: var(--mxg-mark-added);
  --mxg-tone-warning-bar: var(--mxg-mark-dirty);
  --mxg-tone-danger-bar: var(--mxg-danger);
  --mxg-accent-hover: #1547a1;
  --mxg-accent-fg: #ffffff;
  --mxg-bg-overlay: rgb(255 255 255 / 0.7);
  --mxg-shadow: 0 2px 8px rgb(15 23 42 / 0.16);
  --mxg-font: system-ui, 'Noto Sans KR', sans-serif;
  --mxg-icon-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4.5l4 4 4-4' fill='none' stroke='%23676d74' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --mxg-icon-close: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 3l6 6M9 3l-6 6' fill='none' stroke='%23676d74' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  --mxg-icon-filter-off: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath d='M2 2.5h10L8 7.2v3.6L6 12V7.2z' fill='none' stroke='%23676d74' stroke-width='1.3' stroke-linejoin='round'/%3E%3Cpath d='M1.5 12.5l11-11' stroke='%23676d74' stroke-width='1.3' stroke-linecap='round'/%3E%3C/svg%3E");
  --mxg-icon-alert: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='7' fill='%23b42318'/%3E%3Cpath d='M8 4.4v4.3' stroke='%23ffffff' stroke-width='1.8' stroke-linecap='round'/%3E%3Ccircle cx='8' cy='11.6' r='1' fill='%23ffffff'/%3E%3C/svg%3E");
  color-scheme: light;
}
[data-mxg-theme='my-theme'] .mxg:not([data-mxg-theme]):not([data-mxg-theme='my-theme'] [data-mxg-theme]:not([data-mxg-theme='my-theme']) .mxg),
[data-mxg-theme='my-theme'] .mxg-controls:not([data-mxg-theme]):not([data-mxg-theme='my-theme'] [data-mxg-theme]:not([data-mxg-theme='my-theme']) .mxg-controls) {
  --mxg-bg: #ffffff;
  --mxg-fg: #1f2933;
  --mxg-accent: #1a56c4;
  --mxg-border: #d9dee5;
  --mxg-bg-header: #f3f5f8;
  --mxg-bg-selected: #dbe7fb;
  --mxg-danger: #b42318;
  --mxg-mark-dirty: #9a6700;
  --mxg-mark-added: #1a7f37;
  --mxg-fg-muted: #5e656c;
  --mxg-fg-disabled: #9a9fa3;
  --mxg-bg-row-hover: #e8eef9;
  --mxg-bg-row-stripe: #f6f6f7;
  --mxg-border-strong: #84898f;
  --mxg-guide-color: #84898f;
  --mxg-bg-selected-hover: #c8d9f6;
  --mxg-bg-dirty: #f0e8d9;
  --mxg-bg-added: #ddece1;
  --mxg-bg-invalid: #f6e5e3;
  --mxg-bg-find-hit: #efe7d6;
  --mxg-bg-find-active: #e1d1b3;
  --mxg-bg-disabled: #f4f4f5;
  --mxg-control-border: #676d74;
  --mxg-control-border-hover: #414952;
  --mxg-control-bg-active: #e4e5e7;
  --mxg-tone-track: #e4e5e7;
  --mxg-tone-neutral-bg: #edeeef;
  --mxg-tone-neutral-fg: #353e47;
  --mxg-tone-neutral-bar: #676d74;
  --mxg-tone-info-bg: #dfe7f7;
  --mxg-tone-info-fg: #1e3250;
  --mxg-tone-success-bg: #dfede3;
  --mxg-tone-success-fg: #1e3a34;
  --mxg-tone-warning-bg: #f1eadb;
  --mxg-tone-warning-fg: #383529;
  --mxg-tone-danger-bg: #f5e0df;
  --mxg-tone-danger-fg: #3d282e;
  --mxg-fg-header: var(--mxg-fg);
  --mxg-fg-selected: var(--mxg-fg);
  --mxg-focus-ring: var(--mxg-accent);
  --mxg-sort-indicator: var(--mxg-accent);
  --mxg-resize-handle: var(--mxg-border-strong);
  --mxg-border-find-hit: var(--mxg-mark-dirty);
  --mxg-border-find-active: var(--mxg-mark-dirty);
  --mxg-tone-info-bar: var(--mxg-accent);
  --mxg-tone-success-bar: var(--mxg-mark-added);
  --mxg-tone-warning-bar: var(--mxg-mark-dirty);
  --mxg-tone-danger-bar: var(--mxg-danger);
  --mxg-accent-hover: #1547a1;
  --mxg-accent-fg: #ffffff;
  --mxg-bg-overlay: rgb(255 255 255 / 0.7);
  --mxg-shadow: 0 2px 8px rgb(15 23 42 / 0.16);
  --mxg-font: system-ui, 'Noto Sans KR', sans-serif;
  --mxg-icon-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4.5l4 4 4-4' fill='none' stroke='%23676d74' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --mxg-icon-close: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 3l6 6M9 3l-6 6' fill='none' stroke='%23676d74' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  --mxg-icon-filter-off: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath d='M2 2.5h10L8 7.2v3.6L6 12V7.2z' fill='none' stroke='%23676d74' stroke-width='1.3' stroke-linejoin='round'/%3E%3Cpath d='M1.5 12.5l11-11' stroke='%23676d74' stroke-width='1.3' stroke-linecap='round'/%3E%3C/svg%3E");
  --mxg-icon-alert: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='7' fill='%23b42318'/%3E%3Cpath d='M8 4.4v4.3' stroke='%23ffffff' stroke-width='1.8' stroke-linecap='round'/%3E%3Ccircle cx='8' cy='11.6' r='1' fill='%23ffffff'/%3E%3C/svg%3E");
  color-scheme: light;
}
@supports (color: color-mix(in srgb, red 50%, blue)) {
.mxg[data-mxg-theme='my-theme'][data-mxg-theme='my-theme'][data-mxg-theme='my-theme'],
.mxg-controls[data-mxg-theme='my-theme'][data-mxg-theme='my-theme'][data-mxg-theme='my-theme'] {
  --mxg-fg-muted: color-mix(in srgb, var(--mxg-fg) 72%, var(--mxg-bg));
  --mxg-fg-disabled: color-mix(in srgb, var(--mxg-fg) 45%, var(--mxg-bg));
  --mxg-bg-row-hover: color-mix(in srgb, var(--mxg-accent) 10%, var(--mxg-bg));
  --mxg-bg-row-stripe: color-mix(in srgb, var(--mxg-fg) 4%, var(--mxg-bg));
  --mxg-border-strong: color-mix(in srgb, var(--mxg-fg) 55%, var(--mxg-bg));
  --mxg-guide-color: color-mix(in srgb, var(--mxg-fg) 55%, var(--mxg-bg));
  --mxg-bg-selected-hover: color-mix(in srgb, var(--mxg-accent) 10%, var(--mxg-bg-selected));
  --mxg-bg-dirty: color-mix(in srgb, var(--mxg-mark-dirty) 15%, var(--mxg-bg));
  --mxg-bg-added: color-mix(in srgb, var(--mxg-mark-added) 15%, var(--mxg-bg));
  --mxg-bg-invalid: color-mix(in srgb, var(--mxg-danger) 12%, var(--mxg-bg));
  --mxg-bg-find-hit: color-mix(in srgb, var(--mxg-mark-dirty) 16%, var(--mxg-bg));
  --mxg-bg-find-active: color-mix(in srgb, var(--mxg-mark-dirty) 30%, var(--mxg-bg));
  --mxg-bg-disabled: color-mix(in srgb, var(--mxg-fg) 5%, var(--mxg-bg));
  --mxg-control-border: color-mix(in srgb, var(--mxg-fg) 68%, var(--mxg-bg));
  --mxg-control-border-hover: color-mix(in srgb, var(--mxg-fg) 85%, var(--mxg-bg));
  --mxg-control-bg-active: color-mix(in srgb, var(--mxg-fg) 12%, var(--mxg-bg));
  --mxg-tone-track: color-mix(in srgb, var(--mxg-fg) 12%, var(--mxg-bg));
  --mxg-tone-neutral-bg: color-mix(in srgb, var(--mxg-fg) 8%, var(--mxg-bg));
  --mxg-tone-neutral-fg: color-mix(in srgb, var(--mxg-fg) 90%, var(--mxg-bg));
  --mxg-tone-neutral-bar: color-mix(in srgb, var(--mxg-fg) 68%, var(--mxg-bg));
  --mxg-tone-info-bg: color-mix(in srgb, var(--mxg-accent) 14%, var(--mxg-bg));
  --mxg-tone-info-fg: color-mix(in srgb, var(--mxg-fg) 80%, var(--mxg-accent));
  --mxg-tone-success-bg: color-mix(in srgb, var(--mxg-mark-added) 14%, var(--mxg-bg));
  --mxg-tone-success-fg: color-mix(in srgb, var(--mxg-fg) 80%, var(--mxg-mark-added));
  --mxg-tone-warning-bg: color-mix(in srgb, var(--mxg-mark-dirty) 14%, var(--mxg-bg));
  --mxg-tone-warning-fg: color-mix(in srgb, var(--mxg-fg) 80%, var(--mxg-mark-dirty));
  --mxg-tone-danger-bg: color-mix(in srgb, var(--mxg-danger) 14%, var(--mxg-bg));
  --mxg-tone-danger-fg: color-mix(in srgb, var(--mxg-fg) 80%, var(--mxg-danger));
  --mxg-accent-hover: color-mix(in srgb, #000000 18%, var(--mxg-accent));
  --mxg-bg-overlay: color-mix(in srgb, var(--mxg-bg) 70%, transparent);
}
[data-mxg-theme='my-theme'] .mxg:not([data-mxg-theme]):not([data-mxg-theme='my-theme'] [data-mxg-theme]:not([data-mxg-theme='my-theme']) .mxg),
[data-mxg-theme='my-theme'] .mxg-controls:not([data-mxg-theme]):not([data-mxg-theme='my-theme'] [data-mxg-theme]:not([data-mxg-theme='my-theme']) .mxg-controls) {
  --mxg-fg-muted: color-mix(in srgb, var(--mxg-fg) 72%, var(--mxg-bg));
  --mxg-fg-disabled: color-mix(in srgb, var(--mxg-fg) 45%, var(--mxg-bg));
  --mxg-bg-row-hover: color-mix(in srgb, var(--mxg-accent) 10%, var(--mxg-bg));
  --mxg-bg-row-stripe: color-mix(in srgb, var(--mxg-fg) 4%, var(--mxg-bg));
  --mxg-border-strong: color-mix(in srgb, var(--mxg-fg) 55%, var(--mxg-bg));
  --mxg-guide-color: color-mix(in srgb, var(--mxg-fg) 55%, var(--mxg-bg));
  --mxg-bg-selected-hover: color-mix(in srgb, var(--mxg-accent) 10%, var(--mxg-bg-selected));
  --mxg-bg-dirty: color-mix(in srgb, var(--mxg-mark-dirty) 15%, var(--mxg-bg));
  --mxg-bg-added: color-mix(in srgb, var(--mxg-mark-added) 15%, var(--mxg-bg));
  --mxg-bg-invalid: color-mix(in srgb, var(--mxg-danger) 12%, var(--mxg-bg));
  --mxg-bg-find-hit: color-mix(in srgb, var(--mxg-mark-dirty) 16%, var(--mxg-bg));
  --mxg-bg-find-active: color-mix(in srgb, var(--mxg-mark-dirty) 30%, var(--mxg-bg));
  --mxg-bg-disabled: color-mix(in srgb, var(--mxg-fg) 5%, var(--mxg-bg));
  --mxg-control-border: color-mix(in srgb, var(--mxg-fg) 68%, var(--mxg-bg));
  --mxg-control-border-hover: color-mix(in srgb, var(--mxg-fg) 85%, var(--mxg-bg));
  --mxg-control-bg-active: color-mix(in srgb, var(--mxg-fg) 12%, var(--mxg-bg));
  --mxg-tone-track: color-mix(in srgb, var(--mxg-fg) 12%, var(--mxg-bg));
  --mxg-tone-neutral-bg: color-mix(in srgb, var(--mxg-fg) 8%, var(--mxg-bg));
  --mxg-tone-neutral-fg: color-mix(in srgb, var(--mxg-fg) 90%, var(--mxg-bg));
  --mxg-tone-neutral-bar: color-mix(in srgb, var(--mxg-fg) 68%, var(--mxg-bg));
  --mxg-tone-info-bg: color-mix(in srgb, var(--mxg-accent) 14%, var(--mxg-bg));
  --mxg-tone-info-fg: color-mix(in srgb, var(--mxg-fg) 80%, var(--mxg-accent));
  --mxg-tone-success-bg: color-mix(in srgb, var(--mxg-mark-added) 14%, var(--mxg-bg));
  --mxg-tone-success-fg: color-mix(in srgb, var(--mxg-fg) 80%, var(--mxg-mark-added));
  --mxg-tone-warning-bg: color-mix(in srgb, var(--mxg-mark-dirty) 14%, var(--mxg-bg));
  --mxg-tone-warning-fg: color-mix(in srgb, var(--mxg-fg) 80%, var(--mxg-mark-dirty));
  --mxg-tone-danger-bg: color-mix(in srgb, var(--mxg-danger) 14%, var(--mxg-bg));
  --mxg-tone-danger-fg: color-mix(in srgb, var(--mxg-fg) 80%, var(--mxg-danger));
  --mxg-accent-hover: color-mix(in srgb, #000000 18%, var(--mxg-accent));
  --mxg-bg-overlay: color-mix(in srgb, var(--mxg-bg) 70%, transparent);
}
}

Share and import

Import JSON

Paste JSON

Using the files ​

You get three kinds of file. Use only what you need.

  • CSS: load it after the grid CSS and put data-mxg-theme="your-theme-name" on the grid or any ancestor. Put it on one area and only the grids inside change. This theme wins whether the site is light or dark.
  • JavaScript: builds the same theme in code with createTheme and applies it to one grid or one area with applyTheme. Pick the version for <script> tags or for npm (import). Call the returned function to undo it.
  • JSON: the input values, so you can load them again with "Import JSON" above and keep editing. Copying the link and sending it to a teammate fills in the same values too.
html
<link rel="stylesheet" href="maxgrid.css" />
<link rel="stylesheet" href="maxgrid-theme-your-theme-name.css" />
<div data-mxg-theme="your-theme-name"><!-- only grids in here change --></div>

Start from a picture ​

In the "Make a theme from a picture" card, choose one picture (PNG, JPEG, WebP, GIF, AVIF, SVG, up to 10 MB), drop it, or paste it with Ctrl+V. The card picks 4 to 8 main colours. Press a colour to give it a role (accent, background, surface or text); the light and dark previews change together. "Apply as Light" or "Apply as Dark" fills the colour fields below, where you can tune them further.

  • Text gets at least 7:1 against the background, and the other colours are made a little darker or lighter until they pass the contrast check (text 4.5:1, lines and marks 3:1). The card says what was changed and by how much.
  • The same picture always gives the same result. Changing the number of colours picks again from the same picture.
  • The picture is shrunk to 128 px and read in this browser. It is never sent anywhere.

Design tokens ​

  • Import: paste or load W3C design tokens JSON ($type: "color", $value), Tokens Studio JSON ({ "value": "#…", "type": "color" }) or CSS custom properties (--name: #colour;) in the "Import design tokens" card. Names such as primary, accent and brand are matched to accent, background, bg and canvas to background, surface, card and panel to surface, and text, foreground and fg to text. Fix any wrong match in the table. Values that are not colours are skipped, and the card says how many.
  • Export: the "Design tokens" tab of the download panel gives <theme-name>-tokens.json, W3C design tokens JSON with a light and a dark group. In Figma, look for the Tokens Studio plugin or variable import to load it.

Good to know ​

  • Colors accept only #rgb or #rrggbb. A font list may contain only letters, digits, spaces, commas, hyphens and closed quotes.
  • The contrast check uses 4.5:1 for text and 3:1 for lines and marks. You can still make the files when something falls short, and the page lists which combinations are the problem.
  • So that older browsers (those without color-mix()) stay readable, the CSS starts with the calculated colors.
  • The builder stores nothing. There is no account and no server request, and the part of the link after # is never sent to a server.
  • For the full variable list and how to override them by hand, see the Theme guide.