# Other exports

Values exported from `@tangible/ui` that belong to no single component.

- `GENERATIVE_COLORS`: `GenerativeColor[]`. Bag order matters: `stringToGenerativeColor` indexes into it by hash.
- `stringToGenerativeColor`: `(str: string) => GenerativeColor`. Deterministically pick a bag color for a string (name, tag, id). Case-insensitive: "Ada" and "ada" get the same bean.
- `getPagerItems`. The pager's items in reading order: « ‹ 1 … 4 5 6 … 20 › ». Inputs are normalised the way <Pager> normalises its props.
- `DEFAULT_PAGER_SLOTS`: `7`. Slots `smart` mode fills, numbers and ellipses together.
- `markThemeSwitch`: `(doc?: Document) => void`. Mark the document as mid-switch, so a theme change made now styles every control at once instead of fading it in. Call it before you change `data-theme` yourself, for example in the toggle handler of a React app that renders `data-theme={theme}` in JSX: `onClick={() => { markThemeSwitch(); setTheme(next); }}` The marker comes off two animation frames later (or after 100ms if frames are paused). React commits a click's update before the next frame, so the first style pass sees the new theme with durations at zero; the second frame removes the marker, which changes only durations and starts nothing. Overlapping calls are counted, so an earlier call never removes a later call's marker. The count lives in the attribute, so two copies of TUI on one page share it.
- `setColorScheme`: `(scheme: ColorScheme, root?: Element | null) => void`. Set the color scheme on `root`, instantly: no control fades into the new theme (see `markThemeSwitch`). Writes `data-theme` on `root` itself; it does not look for an ancestor that carries one. `'light'`: removes `data-theme` (the default state); `'dark'`: sets `data-theme="dark"`; `'auto'`: sets `data-theme="auto"` (follows `prefers-color-scheme`; light where `matchMedia` is unsupported) Limit: under `'auto'`, an OS-level light/dark change still fades, since no script call precedes it.
- `getColorScheme`: `(root?: Element | null) => ColorScheme`. Read the color scheme set on `root`.
- `getResolvedColorScheme`: `(root?: Element | null) => "light" | "dark"`. Read the scheme actually displayed: `'auto'` resolves through `prefers-color-scheme`.
- `toggleColorScheme`: `(root?: Element | null) => ColorScheme`. Toggle between light and dark (skips auto), instantly, like `setColorScheme`.
- `THEME_SWITCHING_ATTR`: `"data-tui-theme-switching"`. Marker that zeroes `--tui-motion-duration` on every `.tui-interface` while present (see `src/styles/index.scss`). `markThemeSwitch()` manages it; set it by hand only on `<html>` or `<body>`, since a body-level portal root is a sibling of the page's interface and a marker on the interface misses it.
