diff --git a/README.md b/README.md index a42787d..74fff79 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ A small self-hosted URL shortener and link-page tool for a handful of people, with login through Authentik (OIDC). - **Short links**: `/` for admins, `//` for everyone else. Codes can be custom or random, and both codes and destinations can be edited later. -- **Link pages**: a "link in bio" page with avatar, link buttons, Markdown text blocks and colour themes, including built-in and pasted [coolors.co](https://coolors.co) palettes. Blocks are reordered by drag and drop. +- **Link pages**: a "link in bio" page with avatar, link buttons, Markdown text blocks and colour themes, including palettes imported from [coolors.co](https://coolors.co). Blocks are reordered by drag and drop. - **QR codes**: choose the error correction level and colours, then download as PNG or SVG. - **Privacy-friendly stats**: clicks per day, daily unique visitors, last visit. No raw IPs are stored, the visitor hash uses a salt that rotates daily, and individual clicks are deleted after 90 days. - **API with personal access tokens**: for scripts and iOS Shortcuts. diff --git a/src/web/lib/palette.ts b/src/web/lib/palette.ts index bf29603..bfeddff 100644 --- a/src/web/lib/palette.ts +++ b/src/web/lib/palette.ts @@ -2,19 +2,6 @@ import type { Theme } from "../../shared/validation.js"; // Turning coolors.co palettes (5–10 colors) into a link page theme (4 roles). -export interface Palette { - name: string; - colors: string[]; // "#rrggbb" -} - -// Snapshot of the top 4 on https://coolors.co/palettes/trending (October 2026). -export const TRENDING_PALETTES: Palette[] = [ - { name: "Fiery Ocean", colors: hexList("780000-c1121f-fdf0d5-003049-669bbc") }, - { name: "Olive Garden Feast", colors: hexList("606c38-283618-fefae0-dda15e-bc6c25") }, - { name: "Pastel Dreamland", colors: hexList("cdb4db-ffc8dd-ffafcc-bde0fe-a2d2ff") }, - { name: "Ocean Sunset", colors: hexList("001219-005f73-0a9396-94d2bd-e9d8a6-ee9b00-ca6702-bb3e03-ae2012-9b2226") }, -]; - function hexList(dashed: string): string[] { return dashed.split("-").map((h) => `#${h.toLowerCase()}`); } diff --git a/src/web/screens/detail/ThemePicker.tsx b/src/web/screens/detail/ThemePicker.tsx index ba86a35..41a2cfc 100644 --- a/src/web/screens/detail/ThemePicker.tsx +++ b/src/web/screens/detail/ThemePicker.tsx @@ -8,7 +8,7 @@ import { useConfirm } from "../../components/ui/dialog.js"; import { ColorInput, Input } from "../../components/ui/form.js"; import { useToast } from "../../components/ui/toast.js"; import { cx } from "../../lib/cx.js"; -import { parseCoolorsInput, themeFromPalette, TRENDING_PALETTES, type Variant } from "../../lib/palette.js"; +import { parseCoolorsInput, themeFromPalette, type Variant } from "../../lib/palette.js"; export const COLOR_FIELDS: [keyof Theme, string][] = [ ["background", "Background"], @@ -237,7 +237,7 @@ type OpenMenu = | { kind: "variant"; colors: string[]; label: string; anchor: HTMLElement } | null; -// Theme picker: basic presets, trending and saved coolors.co palettes, and custom colors. +// Theme picker: basic presets, the user's saved coolors.co palettes, and custom colors. export function ThemePicker({ theme, onChange }: { theme: Theme; onChange: (theme: Theme) => void }) { const saved = useApi("/palettes"); const toast = useToast(); @@ -326,25 +326,7 @@ export function ThemePicker({ theme, onChange }: { theme: Theme; onChange: (them
- - Colourful - -
- {TRENDING_PALETTES.map((p) => ( - toggleMenu({ kind: "variant", colors: p.colors, label: p.name, anchor })} - onPickColor={(color, anchor) => toggleMenu({ kind: "color", color, anchor })} - /> - ))} -
-
- -
- Your palettes + Your palettes
{ diff --git a/test/palette.test.ts b/test/palette.test.ts index 0c31403..4ffd54c 100644 --- a/test/palette.test.ts +++ b/test/palette.test.ts @@ -1,5 +1,13 @@ import { describe, expect, it } from "vitest"; -import { contrast, parseCoolorsInput, themeFromPalette, TRENDING_PALETTES } from "../src/web/lib/palette.js"; +import { contrast, parseCoolorsInput, themeFromPalette } from "../src/web/lib/palette.js"; + +// A mix of real coolors.co palettes: dark, light, pastel and a 10-color one. +const SAMPLE_PALETTES = [ + "780000-c1121f-fdf0d5-003049-669bbc", + "606c38-283618-fefae0-dda15e-bc6c25", + "cdb4db-ffc8dd-ffafcc-bde0fe-a2d2ff", + "001219-005f73-0a9396-94d2bd-e9d8a6-ee9b00-ca6702-bb3e03-ae2012-9b2226", +].map((p) => parseCoolorsInput(p)!); describe("coolors.co palettes", () => { it("parses palette and generator links as well as bare color lists", () => { @@ -18,8 +26,8 @@ describe("coolors.co palettes", () => { expect(parseCoolorsInput("zzzzzz-2a9d8f")).toBeNull(); }); - it("maps every trending palette to a readable theme in both variants", () => { - for (const { colors } of TRENDING_PALETTES) { + it("maps palettes to a readable theme in both variants", () => { + for (const colors of SAMPLE_PALETTES) { for (const variant of ["dark", "light"] as const) { const theme = themeFromPalette(colors, variant); expect(contrast(theme.text, theme.background)).toBeGreaterThanOrEqual(4.5);