Theming
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.
Text on it: white, 6.0:1. Picked for you unless you set accentFg.
A drawing of a widget, painted with these values. The live demo isn't available right now.
Ocheso.setTheme(null); // back to your brandWhere a theme comes from
Four layers, each over the one before. Later layers only change what they name.
| Layer | Set in | Use it for |
|---|---|---|
| 1. Defaults | Ocheso | A neutral light and dark look that sits on most sites. |
| 2. Your brand | Studio → Brand | Your colour, corners, font, board and mode, for every widget and hosted page. |
| 3. The snippet | data-theme · data-accent · data-radius · data-font · data-board, or t= on an iframe | One page that differs, like a dark landing page. |
| 4. Runtime | Ocheso.setTheme() · widget.setTheme() | Following your site's own dark mode switch, previews. |
At runtime
// 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:
| Key | In t= | Values |
|---|---|---|
| mode | m | auto · light · dark |
| accent | ac | Buttons, links, highlights |
| accentFg | af | Text on the accent (picked for you when left out) |
| bg · surface · surface2 | bg · sf · s2 | Page, cards, insets |
| fg · muted · border | fg · mu · bd | Text, secondary text, hairlines |
| success · warning · danger | ok · wa · er | Status colours |
| radius | r | 0–24 (px) |
| font | f | system · inter · poppins · manrope · roboto |
| board | b | slate · wood · green · brand · contrast |
| boardLight · boardDark | bl · bk | Squares, over the preset |
| boardHighlight · boardCheck | bh · bc | Last 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 #.
https://www.ocheso.com/embed/en/t/weekly-blitz?t=m.dark,ac.e4572e,r.8,f.inter,b.woodDark 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.
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.
| Variable | Light | Dark |
|---|---|---|
| --och-bg | #ffffff | #0e0f12 |
| --och-surface | #ffffff | #16181d |
| --och-surface-2 | #f5f7fa | #1c1f26 |
| --och-fg | #0e0f12 | #f3f4f6 |
| --och-muted | #6b7280 | #9aa3b2 |
| --och-border | rgb(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 · #e5484d | same |
| --och-radius | 12px | 12px |
| --och-font | system stack | system stack |
| --och-board-light | #eef1f5 | #c4cbd6 |
| --och-board-dark | #b3bdcc | #6f7b8f |
| --och-board-highlight · check | #2f55e0 · #e5484d | same |