Skip to content

Theme controller

Switch noodle and light/dark mode for a page, or scope a noodle to any element.

CSS + mian.js JSON Markdown Registry item

Scoped controls

data-mn-target points the controls at one element, so only it changes. Leave data-mn-target out to switch the whole page (and remember the choice).

New

Scoped noodles

Any element can carry its own noodle and mode.

udon
fensi
yinzhen
mee

Installation

Everything ships in one stylesheet and one small script. There is nothing to import per component.

<link rel="stylesheet" href="https://mian.ro/dist/mian.css">
<script src="https://mian.ro/dist/mian.js" defer></script>

Prefer to own the files? /r/theme-controller.json is a registry item with this component's CSS and example markup, ready to copy into your project with any tool that reads the open registry-item format.

Class reference

Class / attributeDescription
data-noodle="…" · data-mode="light | dark"On <html> for the page, or on any element to scope it.
select[data-mn-noodle-select]A select that switches the page noodle.
data-mn-target="#id"On any control: act on that element only, without persisting.
[data-mn-set-noodle] · [data-mn-set-mode] · [data-mn-toggle-mode]Buttons.
Mian.setNoodle(id) · Mian.setMode(mode)Script API; persisted in localStorage.
mn-swatchA 4-colour preview of the current noodle.

Accessibility

  • Buttons report aria-pressed. Without data-mode the page follows the operating system.
Choose a noodle

Minimal

Flat

Pixel

Linear

Thin

Glass

Textured

Bold

Elegant

Rounded

On this page