colorsbymax 0.1.1 → 0.2.0

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 ADDED
@@ -0,0 +1,38 @@
1
+ # Changelog
2
+
3
+ What changed in each colorsbymax release. Update with `npm install colorsbymax@latest`.
4
+
5
+ ## 0.2.0 (2026-09-25)
6
+
7
+ **Upgrading from 0.1.x:** the colour button moves to the bottom-right corner; add `position: 'top-right'` to keep it where it was. If your site doesn't use colorsbymax's `--color-*` variables, themes now re-colour it automatically; to keep the old behaviour (themes set only the variables), pass `recolour: false` in the config.
8
+
9
+ - **One-line setup.** `import 'colorsbymax/auto'` puts the colour button on the page with no wrapping or config. `autoMount(config)` from the same entry takes settings.
10
+ - **Re-colours any site.** Sites with hard-coded colours are re-coloured by swapping the colours actually on the page for the chosen theme's, including gradients, borders and SVG icons, and content that appears later. Sites that use the colour variables work exactly as before.
11
+ - **The colour button now starts in the bottom-right corner**, where chat and help widgets usually sit, and the panel opens above it. `position` picks another corner; `position: 'top-right'` keeps 0.1's spot just under a floating nav bar. Visitors can still drag it anywhere.
12
+ - The site's own group shows its original colours ("… original") when colorsbymax is re-colouring it.
13
+
14
+ ## 0.1.1 (2026-09-25)
15
+
16
+ **Upgrading from 0.1.0:** nothing to change for most sites. The one exception: PDF uploads are now opt-in. To keep them, install `pdfjs-dist` and pass the loader in your config:
17
+
18
+ ```bash
19
+ npm install pdfjs-dist
20
+ ```
21
+
22
+ ```jsx
23
+ import { loadPdf } from 'colorsbymax/pdf'
24
+
25
+ <ThemeProvider config={{ ...config, pdf: loadPdf }}>
26
+ ```
27
+
28
+ Without it, "Palette from an image" still works; it just takes images only. If you call `coloursFromFile` yourself, pass `{ loadPdf }` as its second argument for PDFs.
29
+
30
+ - **TypeScript types included.** No more "Could not find a declaration file for module 'colorsbymax'" (TS7016) in strict projects; `useTheme()`, the config and the colour helpers are fully typed.
31
+ - **Much smaller install.** No runtime dependencies besides React: about 440 KB instead of 44 MB. The panel's icons are built in, so it no longer adds a second copy of `lucide-react` next to your own, and PDF.js is no longer installed unless you opt in.
32
+ - **No install scripts**, so npm has nothing to ask you to approve for colorsbymax.
33
+ - Site scans ignore colour transitions, so sites that animate colour changes scan their own colours rather than the applied theme's.
34
+ - README: an "At a glance" section (Tailwind is optional, ESM only, types included) and PDF opt-in docs.
35
+
36
+ ## 0.1.0 (2026-09-25)
37
+
38
+ First release: the floating colour button and panel, site themes and scan, Max's picks and the 715-theme library, custom palettes, overrides, JSON import/export, palettes from images and PDFs, light and dark mode, visitor settings, and WCAG contrast checks with one-click fixes.
package/README.md CHANGED
@@ -6,7 +6,8 @@ A floating theme switcher for websites. Visitors (or the site's owner) can re-co
6
6
 
7
7
  **At a glance**
8
8
 
9
- - **React 18 or 19.** `npm install colorsbymax`, then wrap your app (see [Add it to a site](#add-it-to-a-site)).
9
+ - **Two steps.** `npm install colorsbymax`, then `import 'colorsbymax/auto'` once. The colour button appears and visitors can re-colour the site, even if its colours are hard-coded (see [Quick start](#quick-start)).
10
+ - **React 18 or 19.**
10
11
  - **Tailwind optional.** The panel carries its own styles, so it works with Tailwind v4, older Tailwind or plain CSS. Your site only needs to paint its colours with `var(--color-…)` variables. The optional `colorsbymax/tokens.css` helper is for Tailwind v4 (`@theme` syntax); without Tailwind v4, define the variables yourself.
11
12
  - **TypeScript types included.**
12
13
  - **No runtime dependencies** besides React. PDF uploads are opt-in and need `pdfjs-dist` (see [PDF uploads](#pdf-uploads)).
@@ -44,17 +45,37 @@ npm install
44
45
  npm run dev
45
46
  ```
46
47
 
47
- This serves `demo/`: colorsbymax's own landing page, built with Tailwind, where every colour is a token (it uses every token group, and a strip shows the live values), and `/plain.html`, a plain-CSS bakery site with deliberately careless global styles to show they don't reach the panel.
48
+ This serves `demo/`: colorsbymax's own landing page, built with Tailwind, where every colour is a token (it uses every token group, and a strip shows the live values); `/plain.html`, a plain-CSS bakery site with deliberately careless global styles to show they don't reach the panel; and `/unwired.html`, a coffee shop with only hard-coded colours whose whole setup is `import 'colorsbymax/auto'`.
48
49
 
49
- ## Add it to a site
50
-
51
- colorsbymax needs React 18 or 19:
50
+ ## Quick start
52
51
 
53
52
  ```bash
54
53
  npm install colorsbymax
55
54
  ```
56
55
 
57
- It ships as plain JavaScript with TypeScript types, so Vite, Next.js, webpack and other bundlers use it without extra setup. Installing changes nothing on its own; these steps add the colour button:
56
+ Then add one line anywhere in your site's code, for example `main.jsx`:
57
+
58
+ ```js
59
+ import 'colorsbymax/auto'
60
+ ```
61
+
62
+ That's all. The colour button appears in the bottom-right corner once the page has loaded, and visitors can start swapping the site's colours. (npm doesn't let a package change your site on install, so this one line is the only step.)
63
+
64
+ - **Any site's colours.** If your site doesn't use colorsbymax's colour variables, colorsbymax reads the colours actually on the page (backgrounds, text, borders, gradients and icons) and swaps each for its counterpart in the chosen theme: greys follow the theme's background and text, brand shades follow its brand colour, and success and error colours keep their meaning. Content added later is re-coloured too, and picking the site's own theme brings back the exact original.
65
+ - **Settings.** Use `autoMount` instead of the plain import:
66
+
67
+ ```js
68
+ import { autoMount } from 'colorsbymax/auto'
69
+ autoMount({ siteName: 'My site', storageKey: 'my-site-theme' })
70
+ ```
71
+
72
+ - **Where automatic re-colouring falls short:** images keep their colours, hover and focus colours keep the site's own, and colours drawn by `::before`/`::after` aren't swapped. For full control, use the colour variables below; colorsbymax then applies themes to them directly, with no page reading at all.
73
+
74
+ Already installed it? Get the newest version with `npm install colorsbymax@latest` (see [Updating](#updating)).
75
+
76
+ ## Add it to a site
77
+
78
+ This is the full setup, for sites that want exact control over which colour goes where. colorsbymax needs React 18 or 19, and ships as plain JavaScript with TypeScript types, so Vite, Next.js, webpack and other bundlers use it without extra setup:
58
79
 
59
80
  1. **Paint the site with the token variables.** Use `var(--color-<token>)` wherever the site sets a colour, with your own colours as the starting values.
60
81
 
@@ -108,6 +129,10 @@ Without a `siteName`, the site group is named from the page's `og:site_name`, it
108
129
  usage: { primary: 'Buttons…' }, // optional notes shown in the colour editors
109
130
  scrollbars: true, // colour the page's scrollbars from the theme (default)
110
131
  pdf: loadPdf, // optional: allow PDF uploads (see below)
132
+ recolour: 'auto', // re-colour hard-coded colours: 'auto' (only if the site has
133
+ // no --color-* variables, the default), true or false
134
+ position: 'bottom-right', // where the button starts: bottom-right (default), bottom-left,
135
+ // top-left, or top-right (just under a floating nav bar)
111
136
  }
112
137
  ```
113
138
 
@@ -129,6 +154,16 @@ PDF.js still downloads only when a visitor picks a PDF. Sites that don't opt in
129
154
 
130
155
  `examples/tsungi.config.js` is a complete example for tsungi.online, the first site to use colorsbymax.
131
156
 
157
+ ## Updating
158
+
159
+ ```bash
160
+ npm install colorsbymax@latest
161
+ ```
162
+
163
+ This moves you to the newest release and records it in your `package.json`. `npm update` alone isn't enough while colorsbymax is below 1.0: with the usual `^0.1.0` range, npm treats 0.2.0 as a breaking change and stays on 0.1.x. Check which version you have with `npm ls colorsbymax`.
164
+
165
+ What changed in each release, and anything you need to do when upgrading, is in [CHANGELOG.md](CHANGELOG.md).
166
+
132
167
  ## Building the package
133
168
 
134
169
  `src/` is the source; `dist/` is what sites install: plain JavaScript with the JSX compiled away. `types/` holds the hand-written TypeScript declarations; `npm run typecheck` compiles `types/check.tsx` against them and checks they match the built exports. The panel's icons are copied from Lucide into `src/icons.jsx` by `npm run icons`. `dist/` is committed so installs straight from GitHub work even when npm skips install scripts, so rebuild it before committing changes to `src/`. `npm publish` also rebuilds it first: