From a5ca325eb33bf67bc2709668352523fa36fbf083 Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Mon, 26 Oct 2026 18:49:31 -0700 Subject: [PATCH 1/4] Use our own diff colors instead of deriving them from themes Themes define diff colors too inconsistently to rely on (missing keys, translucent gutter colors, git decoration colors that aren't green or red), so the old fallback chain produced washed-out or invisible highlights in many themes. Take only the editor foreground, background, selection, and hunk header colors from the theme. Added/removed lines and changed words use fixed green/red accents as translucent tints, so they sit on any theme background, with stronger changed-word highlights. Changed lines within diffed patch files are colored by mixing the accents with the theme foreground instead of a stacked background. Drops chroma-js, which was only used for theme color math. --- pnpm-lock.yaml | 16 -- web/package.json | 2 - web/src/lib/components/diff/TextDiff.svelte | 36 ++- .../lib/components/diff/text-diff.svelte.ts | 269 +++--------------- 4 files changed, 58 insertions(+), 265 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7c7fc71..27f91fc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -13,9 +13,6 @@ importers: bits-ui: specifier: ^2.20.2 version: 2.20.2(@internationalized/date@3.12.1)(@sveltejs/kit@3.1.0(@sveltejs/vite-plugin-svelte@7.3.1(svelte@5.57.2(@typescript-eslint/types@8.72.0))(vite@8.3.5(@types/node@26.6.5)(esbuild@0.28.2)(jiti@2.7.0)))(svelte@5.57.2(@typescript-eslint/types@8.72.0))(typescript@6.0.3)(vite@8.3.5(@types/node@26.6.5)(esbuild@0.28.2)(jiti@2.7.0)))(svelte@5.57.2(@typescript-eslint/types@8.72.0)) - chroma-js: - specifier: ^3.2.0 - version: 3.2.0 diff: specifier: ^9.0.0 version: 9.0.0 @@ -65,9 +62,6 @@ importers: '@tailwindcss/vite': specifier: ^4.3.3 version: 4.3.3(vite@8.3.5(@types/node@26.6.5)(esbuild@0.28.2)(jiti@2.7.0)) - '@types/chroma-js': - specifier: ^3.1.3 - version: 3.1.3 '@types/luxon': specifier: ^3.7.6 version: 3.7.6 @@ -981,9 +975,6 @@ packages: '@types/chai@5.2.3': resolution: {integrity: sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==} - '@types/chroma-js@3.1.3': - resolution: {integrity: sha512-r4kI3HTbLdayBkY1f2Xv7/1TJaHTS//8f6Etv036NQMIj2jVPngUV11NczKiLFKyy01o6hGYVDypP7tJVoFPew==} - '@types/deep-eql@4.0.2': resolution: {integrity: sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==} @@ -1159,9 +1150,6 @@ packages: resolution: {integrity: sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==} engines: {node: '>= 14.16.0'} - chroma-js@3.2.0: - resolution: {integrity: sha512-os/OippSlX1RlWWr+QDPcGUZs0uoqr32urfxESG9U93lhUfbnlyckte84Q8P1UQY/qth983AS1JONKmLS4T0nw==} - chrome-types@0.1.459: resolution: {integrity: sha512-ev1r7o/gAQ4wU97Uz9yWAhAeXQrti1BbuPsMcleabjpgCigG9mF1rnDW7uVypDy2SyOIfqHZHp+Us4AZolDe6g==} @@ -2919,8 +2907,6 @@ snapshots: '@types/deep-eql': 4.0.2 assertion-error: 2.0.1 - '@types/chroma-js@3.1.3': {} - '@types/deep-eql@4.0.2': {} '@types/esrecurse@4.3.1': {} @@ -3115,8 +3101,6 @@ snapshots: dependencies: readdirp: 4.1.2 - chroma-js@3.2.0: {} - chrome-types@0.1.459: {} clsx@2.1.1: {} diff --git a/web/package.json b/web/package.json index e5a3d66..9c176db 100644 --- a/web/package.json +++ b/web/package.json @@ -29,7 +29,6 @@ "@sveltejs/kit": "^3.1.0", "@sveltejs/vite-plugin-svelte": "^7.3.1", "@tailwindcss/vite": "^4.3.3", - "@types/chroma-js": "^3.1.3", "@types/luxon": "^3.7.6", "@types/node": "^26.6.5", "@types/wicg-file-system-access": "^2023.10.7", @@ -52,7 +51,6 @@ }, "dependencies": { "bits-ui": "^2.20.2", - "chroma-js": "^3.2.0", "diff": "^9.0.0", "luxon": "^3.7.2", "paneforge": "^1.0.2", diff --git a/web/src/lib/components/diff/TextDiff.svelte b/web/src/lib/components/diff/TextDiff.svelte index deecaa7..715a8d4 100644 --- a/web/src/lib/components/diff/TextDiff.svelte +++ b/web/src/lib/components/diff/TextDiff.svelte @@ -268,25 +268,33 @@