colorsbymax 0.2.0 → 0.2.1
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 +12 -0
- package/README.md +45 -0
- package/dist/{ThemeSwitcher-CnxUWdBP.js → ThemeSwitcher-C0SSJ-oR.js} +1130 -50
- package/dist/auto.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/types/index.d.ts +13 -0
package/dist/auto.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { s as ThemeProvider, t as ThemeSwitcher } from "./ThemeSwitcher-
|
|
1
|
+
import { s as ThemeProvider, t as ThemeSwitcher } from "./ThemeSwitcher-C0SSJ-oR.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 rolesFromPalette, b as BASE_TOKENS, c as applyTokens, d as prePaintScript, f as collectColors, g as themeFromRoles, h as suggestThemes, i as dominantColours, j as checkRamp, k as MIN_RAMP_STEP_DELTA_E, l as useTheme, m as inferRoles, n as DEFAULT_SETTINGS, o as themeFromPalette, p as detectSiteName, r as coloursFromFile, s as ThemeProvider, t as ThemeSwitcher, u as DEFAULT_STORAGE_KEY, v as isDarkTheme, w as completeTokens, x as PRESETS, y as toDark } from "./ThemeSwitcher-
|
|
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 rolesFromPalette, b as BASE_TOKENS, c as applyTokens, d as prePaintScript, f as collectColors, g as themeFromRoles, h as suggestThemes, i as dominantColours, j as checkRamp, k as MIN_RAMP_STEP_DELTA_E, l as useTheme, m as inferRoles, n as DEFAULT_SETTINGS, o as themeFromPalette, p as detectSiteName, r as coloursFromFile, s as ThemeProvider, t as ThemeSwitcher, u as DEFAULT_STORAGE_KEY, v as isDarkTheme, w as completeTokens, x as PRESETS, y as toDark } from "./ThemeSwitcher-C0SSJ-oR.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
package/types/index.d.ts
CHANGED
|
@@ -80,6 +80,11 @@ export interface ColorsByMaxConfig {
|
|
|
80
80
|
* 'top-right' sits just under a floating nav bar. Visitors can still drag it anywhere.
|
|
81
81
|
*/
|
|
82
82
|
position?: 'bottom-right' | 'bottom-left' | 'top-left' | 'top-right'
|
|
83
|
+
/**
|
|
84
|
+
* Hide the colour button and panel; the theme still applies. `hidden: import.meta.env.PROD`
|
|
85
|
+
* keeps it out of production once the colours are chosen, while it still shows in development.
|
|
86
|
+
*/
|
|
87
|
+
hidden?: boolean
|
|
83
88
|
}
|
|
84
89
|
|
|
85
90
|
export interface ThemeProviderProps {
|
|
@@ -114,8 +119,12 @@ export interface ThemeApi {
|
|
|
114
119
|
usage: Partial<Record<TokenKey, string>>
|
|
115
120
|
loadPdf: (() => Promise<unknown>) | null
|
|
116
121
|
position: 'bottom-right' | 'bottom-left' | 'top-left' | 'top-right'
|
|
122
|
+
/** True when the config hides the switcher; the theme still applies. */
|
|
123
|
+
hidden: boolean
|
|
117
124
|
/** True when colorsbymax is swapping the page's own colours (the site isn't using the variables). */
|
|
118
125
|
recolouring: boolean
|
|
126
|
+
/** Turns re-colouring of the site's logo on or off. */
|
|
127
|
+
setLogoColouring(on: boolean): void
|
|
119
128
|
/** The site's own themes, then any scan suggestions. */
|
|
120
129
|
siteThemes: Theme[]
|
|
121
130
|
defaultTheme: Theme
|
|
@@ -184,6 +193,10 @@ export interface PanelSettings {
|
|
|
184
193
|
panelWidth: number | null
|
|
185
194
|
panelHeight: number | 'full' | null
|
|
186
195
|
libraryCollapsed: boolean
|
|
196
|
+
/** Whether themes re-colour the site's logo too. Off (the default) keeps its own colours. */
|
|
197
|
+
colourLogo: boolean
|
|
198
|
+
/** Hidden on this device (from the finish screen); Alt+Shift+C or ?colorsbymax brings it back. */
|
|
199
|
+
hideButton: boolean
|
|
187
200
|
}
|
|
188
201
|
/** The visitor settings the panel starts with. */
|
|
189
202
|
export const DEFAULT_SETTINGS: PanelSettings
|