Skip to content
Developers · Embed

Theming

Widgets take your colours, corners, font and board, in light and dark. Set your brand once in Studio; adjust per snippet or at runtime when a page needs it.

Try it

Each change below calls Ocheso.setTheme(), just as your page would, and prints the same theme as a call, as attributes, and as an iframe address.

Mode
Accent

Text on it: white, 6.0:1. Picked for you unless you set accentFg.

Corners
Font
Board
YoursiteSample
Board 1 · live2:41
Fatou D. (1688)
♜︎♝︎♛︎♚︎♝︎♞︎♜︎♟︎♟︎♟︎♟︎♟︎♟︎♟︎♞︎♝︎♟︎♟︎♞︎♟︎♟︎♟︎♟︎♟︎♟︎♟︎♜︎♞︎♝︎♛︎♚︎♜︎
Amina N. (1840)2:58
Powered by Ocheso

A drawing of a widget, painted with these values. The live demo isn't available right now.

Ocheso.setTheme(null); // back to your brand

Where a theme comes from

Four layers, each over the one before. Later layers only change what they name.

LayerSet inUse it for
1. DefaultsOchesoA neutral light and dark look that sits on most sites.
2. Your brandStudio → BrandYour colour, corners, font, board and mode, for every widget and hosted page.
3. The snippetdata-theme · data-accent · data-radius · data-font · data-board, or t= on an iframeOne page that differs, like a dark landing page.
4. RuntimeOcheso.setTheme() · widget.setTheme()Following your site's own dark mode switch, previews.
Everything is checked before it is used: colours must be hex, the radius a whole number from 0 to 24, fonts and boards one of the names below. Anything else is dropped. A theme can never carry CSS.

At runtime

JavaScript
// Every widget on the page, merged over what was set before:
Ocheso.setTheme({ mode: "dark", accent: "#e4572e", radius: 8 });

// Follow your own site's dark mode switch:
myThemeToggle.onChange((dark) => Ocheso.setTheme({ mode: dark ? "dark" : "light" }));

// Back to the snippet's and your brand's own:
Ocheso.setTheme(null);

widget.setTheme()does the same for one widget, over the page's theme. The keys are the same everywhere:

KeyIn t=Values
modemauto · light · dark
accentacButtons, links, highlights
accentFgafText on the accent (picked for you when left out)
bg · surface · surface2bg · sf · s2Page, cards, insets
fg · muted · borderfg · mu · bdText, secondary text, hairlines
success · warning · dangerok · wa · erStatus colours
radiusr0–24 (px)
fontfsystem · inter · poppins · manrope · roboto
boardbslate · wood · green · brand · contrast
boardLight · boardDarkbl · bkSquares, over the preset
boardHighlight · boardCheckbh · bcLast move, king in check

On a plain iframe

An iframe can't run your script, so its theme rides in the address as t=: pairs of a short key and a value, separated by commas, colours without the #.

iframe src
https://www.ocheso.com/embed/en/t/weekly-blitz?t=m.dark,ac.e4572e,r.8,f.inter,b.wood

Dark mode

  • auto(the default) follows the visitor's system setting, and switches live when it changes.
  • If your site has its own light/dark switch, set the mode from it with Ocheso.setTheme({ mode }) so the widget matches your page rather than the system.
  • Your accent works in both schemes; text on it is re-checked for contrast either way.

Boards

Five presets, each with a light and a dark scheme. brand is tinted from your accent (shown here with #e4572e). Set single squares over a preset with boardLight and boardDark. Piece sets are the same for everyone in this version.

slate
light · dark scheme
wood
light · dark scheme
green
light · dark scheme
contrast
light · dark scheme
brand
light · dark scheme

Fonts

system uses the visitor's own interface font and costs nothing to load. inter, poppins, manrope and robotoare served by Ocheso from www.ocheso.com, inside the frame: your visitors' browsers never contact Google Fonts because of a widget.

The variables

For reference, what the widget paints with. You can't set them directly from your page (the frame is a separate document); the keys above map onto them.

VariableLightDark
--och-bg#ffffff#0e0f12
--och-surface#ffffff#16181d
--och-surface-2#f5f7fa#1c1f26
--och-fg#0e0f12#f3f4f6
--och-muted#6b7280#9aa3b2
--och-borderrgb(14 15 18 / .1)rgb(255 255 255 / .1)
--och-accent#2f55e0#2f55e0
--och-accent-fg#ffffff (picked for 4.5:1)same
--och-success · warning · danger#12a150 · #d99400 · #e5484dsame
--och-radius12px12px
--och-fontsystem stacksystem stack
--och-board-light#eef1f5#c4cbd6
--och-board-dark#b3bdcc#6f7b8f
--och-board-highlight · check#2f55e0 · #e5484dsame