- Docs
- Changelog
Changelog
Every @samline/theme release, newest first, with breaking changes, behavior changes and upgrade steps called out explicitly.
All notable changes to this package. Format: Keep a Changelog; versions follow semver.
[1.1.0] - 2026-11-17
Changed
- Internal: the DOM controller moved from
src/coretosrc/vanilla;src/corekeeps the DOM-free types, constants and helpers. Public entries are unchanged. toggle()(anddata-theme-toggle) goes back tosystemwhen the theme it switches to is the one the operating system shows, instead of storing it. Toggling twice no longer pins the theme against later system changes. With adefaultModeother thansystem, it still storeslightordark.- The package moved from the
samline/utilsmonorepo to its own repository, samline/theme. Homepage, repository and documentation links point to the package’s own site.
Fixed
themeScript()ignores adefaultModethat is not one ofthemesand follows the system, likecreateTheme(). Before, the inline script wrote the unknown name and the controller then switched to the system theme, so the page flashed.
[1.0.0] - 2026-11-13
Added
- First release:
createThememanages light, dark and system themes, or any named themes, written on<html>(or anytarget) asdata-themeor a class, withcolor-scheme, an optional<meta name="theme-color">, a choice remembered inlocalStorage(errors ignored), live system changes while in system mode, sync across tabs, transitions paused while switching,subscribe, athemechangeevent and delegateddata-theme-set,data-theme-toggleanddata-theme-selectcontrols witharia-pressedand checked state.themeScriptreturns an inline<head>snippet that applies the stored theme before the first paint on server-rendered pages. ESM, CommonJS and a browser global (window.Theme) that applies the theme as soon as it loads in<head>.