colorsbymax 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  What changed in each colorsbymax release. Update with `npm install colorsbymax@latest`.
4
4
 
5
+ ## 0.3.2 (2026-09-25)
6
+
7
+ - **`defaultMode` config option:** the mode first-time visitors start in, `'light'` (the default), `'dark'` or `'system'` to follow their device. Any site can start dark, since every theme has a dark twin, and visitors can still switch. The colorsbymax site now opens in dark mode.
8
+ - The colorsbymax site's browser-tab icon is the mrmaxdesigns logo mark in the current theme's colours, with a version for light tabs and one for dark tabs, each checked to stand out.
9
+
5
10
  ## 0.3.1 (2026-09-25)
6
11
 
7
12
  - **`colourLogo` config option:** start with "Colour the logo too" on, for sites whose logo is drawn in the theme's colours. It's off by default, so logos keep their own colours, and visitors can still change it in settings. It also applies when the switcher is hidden. The colorsbymax site turns it on for its wordmark.
package/README.md CHANGED
@@ -326,6 +326,8 @@ Without a `siteName`, the site group is named from the page's `og:site_name`, it
326
326
  position: 'bottom-right', // where the button starts: bottom-right (default), bottom-left,
327
327
  // top-left, or top-right (just under a floating nav bar)
328
328
  hidden: import.meta.env.PROD, // hide the button (the theme still applies), e.g. in production
329
+ defaultMode: 'light', // the mode first-time visitors start in: 'light' (default),
330
+ // 'dark', or 'system' to follow their device
329
331
  colourLogo: false, // themes colour the logo too, for first-time visitors (default
330
332
  // false: it keeps its own colours); visitors can change it
331
333
  intro: true, // the button pops in with a burst of the theme's colours a moment
@@ -1912,6 +1912,8 @@ var newId = () => `custom-${Date.now().toString(36)}-${Math.random().toString(36
1912
1912
  * Where each token is used on this site, shown in the editors
1913
1913
  * @property {boolean} [scrollbars] Colour the page's scrollbars from the theme (default true)
1914
1914
  * @property {() => Promise<any>} [pdf] Enables PDF uploads: pass `loadPdf` from 'colorsbymax/pdf'
1915
+ * @property {'light' | 'dark' | 'system'} [defaultMode] The mode a first-time visitor starts in
1916
+ * (default 'light'; 'system' follows their device). Visitors can still change it.
1915
1917
  * @property {boolean} [colourLogo] Whether themes colour the site's logo for a first-time visitor
1916
1918
  * (default false: the logo keeps its own colours). Visitors can still change it in settings.
1917
1919
  * @property {boolean} [intro] Bring the colour button in with a short pop and burst of the theme's
@@ -2017,7 +2019,12 @@ function ThemeProvider({ config = {}, children }) {
2017
2019
  }, [recolourMode]);
2018
2020
  const settingDefaults = useMemo(() => ({
2019
2021
  ...DEFAULT_SETTINGS,
2020
- colourLogo: Boolean(initialConfig.colourLogo)
2022
+ colourLogo: Boolean(initialConfig.colourLogo),
2023
+ mode: [
2024
+ "light",
2025
+ "dark",
2026
+ "system"
2027
+ ].includes(initialConfig.defaultMode) ? initialConfig.defaultMode : DEFAULT_SETTINGS.mode
2021
2028
  }), [initialConfig]);
2022
2029
  const [logoColouring, setLogoColouring] = useState(() => loadSettings(storageKey, settingDefaults).colourLogo);
2023
2030
  useLayoutEffect(() => {
package/dist/auto.js CHANGED
@@ -1,4 +1,4 @@
1
- import { o as ThemeProvider, t as ThemeSwitcher } from "./ThemeSwitcher-Bl_5Us5y.js";
1
+ import { o as ThemeProvider, t as ThemeSwitcher } from "./ThemeSwitcher-BlWfKjRg.js";
2
2
  import { createElement } from "react";
3
3
  import { createRoot } from "react-dom/client";
4
4
  //#region src/auto.js
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { A as PAIRINGS, C as TOKEN_KEYS, D as MIN_CONTRAST_NON_TEXT, E as MIN_CONTRAST_LARGE_TEXT, F as contrastRatio, I as normalizeHex, M as checkTheme, N as fixAll, O as MIN_CONTRAST_TEXT, P as suggestFix, S as TOKEN_GROUPS, T as deriveAppTokens, _ as darkTokens, a as themeFromPalette, b as BASE_TOKENS, c as useTheme, d as DEFAULT_SETTINGS, f as collectColors, g as themeFromRoles, h as suggestThemes, i as rolesFromPalette, j as checkRamp, k as MIN_RAMP_STEP_DELTA_E, l as DEFAULT_STORAGE_KEY, m as inferRoles, n as coloursFromFile, o as ThemeProvider, p as detectSiteName, r as dominantColours, s as applyTokens, t as ThemeSwitcher, u as prePaintScript, v as isDarkTheme, w as completeTokens, x as PRESETS, y as toDark } from "./ThemeSwitcher-Bl_5Us5y.js";
1
+ import { A as PAIRINGS, C as TOKEN_KEYS, D as MIN_CONTRAST_NON_TEXT, E as MIN_CONTRAST_LARGE_TEXT, F as contrastRatio, I as normalizeHex, M as checkTheme, N as fixAll, O as MIN_CONTRAST_TEXT, P as suggestFix, S as TOKEN_GROUPS, T as deriveAppTokens, _ as darkTokens, a as themeFromPalette, b as BASE_TOKENS, c as useTheme, d as DEFAULT_SETTINGS, f as collectColors, g as themeFromRoles, h as suggestThemes, i as rolesFromPalette, j as checkRamp, k as MIN_RAMP_STEP_DELTA_E, l as DEFAULT_STORAGE_KEY, m as inferRoles, n as coloursFromFile, o as ThemeProvider, p as detectSiteName, r as dominantColours, s as applyTokens, t as ThemeSwitcher, u as prePaintScript, v as isDarkTheme, w as completeTokens, x as PRESETS, y as toDark } from "./ThemeSwitcher-BlWfKjRg.js";
2
2
  export { BASE_TOKENS, DEFAULT_SETTINGS, DEFAULT_STORAGE_KEY, MIN_CONTRAST_LARGE_TEXT, MIN_CONTRAST_NON_TEXT, MIN_CONTRAST_TEXT, MIN_RAMP_STEP_DELTA_E, PAIRINGS, PRESETS, TOKEN_GROUPS, TOKEN_KEYS, ThemeProvider, ThemeSwitcher, applyTokens, checkRamp, checkTheme, collectColors, coloursFromFile, completeTokens, contrastRatio, darkTokens, deriveAppTokens, detectSiteName, dominantColours, fixAll, inferRoles, isDarkTheme, normalizeHex, prePaintScript, rolesFromPalette, suggestFix, suggestThemes, themeFromPalette, themeFromRoles, toDark, useTheme };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "colorsbymax",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "A live theme switcher for any website: site themes, 700+ palettes, for light/dark modes and WCAG contrast checks.",
5
5
  "keywords": [
6
6
  "theme",
package/types/index.d.ts CHANGED
@@ -95,6 +95,11 @@ export interface ColorsByMaxConfig {
95
95
  * its own colours). Visitors can still change it in the panel's settings.
96
96
  */
97
97
  colourLogo?: boolean
98
+ /**
99
+ * The mode a first-time visitor starts in (default 'light'; 'system' follows their device). Any
100
+ * site can start dark: every theme has a dark twin. Visitors can still change it.
101
+ */
102
+ defaultMode?: 'light' | 'dark' | 'system'
98
103
  }
99
104
 
100
105
  export interface ThemeProviderProps {