Dark mode from mtps/homepage
Publish / publish (push) Successful in 5s

Under prefers-color-scheme: dark, use homepage's translucent
magenta-to-blue gradient with exclusion instead of difference.
--waves-dark-from/-to/-blend override it, --waves-blend the light
blend. The texture is referenced once, so it's inlined once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mtpsandClaude Opus 5.5 committed 2026-10-20 13:52:53 +00:00
1 parent f646b31c92
commit 86c73641a3
3 files changed
+25 -9

No files matched your search

+10 -1
View File
@@ -2,7 +2,7 @@
The wave background from [mtps/auth](https://git.app.ygg/mtps/auth): a tiling wave texture under a colour gradient, blended with `difference`. It ships as one self-contained CSS file with the texture inlined, so it works the same in Astro, Vite or a plain `<link>`, with no asset paths to resolve.
Open `demo.html` after `pnpm build` to see it.
Open `demo.html` after `pnpm build` to see it; switch the OS to dark mode for the dark look.
## Install
@@ -34,6 +34,15 @@ The class works on any element, not just `body`. Set these variables on the elem
| `--waves-to` | `hsl(7 82% 63%)` | gradient end |
| `--waves-angle` | `-45deg` | gradient direction |
| `--waves-tile` | `400px` | texture tile size |
| `--waves-blend` | `difference` | blend of gradient and texture |
With `prefers-color-scheme: dark` it switches to the dark look from [mtps/homepage](https://git.app.ygg/mtps/homepage): a translucent magenta-to-blue gradient blended with `exclusion`. These replace `--waves-from`, `--waves-to` and `--waves-blend` in dark mode:
| variable | default |
|---|---|
| `--waves-dark-from` | `hsl(304 97% 37% / 0.4)` |
| `--waves-dark-to` | `hsl(218 97% 37% / 0.4)` |
| `--waves-dark-blend` | `exclusion` |
```css
.night { --waves-from: #3a6073; --waves-to: #16222a; --waves-angle: 160deg; }
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@mtps/waves",
"version": "0.1.0",
"version": "0.2.0",
"description": "Wave texture under a colour gradient, as one self-contained CSS file",
"license": "UNLICENSED",
"type": "module",
+14 -7
View File
@@ -3,15 +3,22 @@
* `difference`. Originally the page background of mtps/auth.
*
* Put class="waves" on any element (body included) and override the
* variables on it or any ancestor.
* variables on it or any ancestor. Under prefers-color-scheme: dark it
* switches to the darker look from mtps/homepage, with its own variables.
*/
.waves {
--_waves-from: var(--waves-from, #f7b440);
--_waves-to: var(--waves-to, hsl(7 82% 63%));
--_waves-blend: var(--waves-blend, difference);
background:
linear-gradient(
var(--waves-angle, -45deg),
var(--waves-from, #f7b440) 0%,
var(--waves-to, hsl(7 82% 63%)) 100%
),
linear-gradient(var(--waves-angle, -45deg), var(--_waves-from) 0%, var(--_waves-to) 100%),
url('./waves.png') 0 0 / var(--waves-tile, 400px) repeat;
background-blend-mode: difference;
background-blend-mode: var(--_waves-blend);
}
@media (prefers-color-scheme: dark) {
.waves {
--_waves-from: var(--waves-dark-from, hsl(304 97% 37% / 0.4));
--_waves-to: var(--waves-dark-to, hsl(218 97% 37% / 0.4));
--_waves-blend: var(--waves-dark-blend, exclusion);
}
}