From 046ca06fcb6cd20dcbb5c8e729a79eb099d8e25d Mon Sep 17 00:00:00 2001 From: Michael Ramos Date: Sun, 11 Jan 2026 09:37:42 -0800 Subject: [PATCH] feat: improve dark mode contrast and add success/warning tokens (#54) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Lift background from 13% to 15% lightness (softer than pure black) - Soften foreground from 95% to 90% (reduces glare) - Increase surface elevation separation (card 22%, popover 28%) - Make muted-foreground more readable (65% → 72%) - Make borders more visible (28% → 35%) - Add --success and --warning design tokens - Replace all hardcoded Tailwind colors (green-500, purple-500, yellow-500) with design tokens for consistent theming - Boost annotation highlight opacity in dark mode for better readability Closes #53 Co-authored-by: Claude Opus 4.5 --- packages/editor/App.tsx | 6 +- packages/editor/index.css | 57 +++++++++++++------ packages/ui/components/AnnotationPanel.tsx | 4 +- packages/ui/components/AnnotationToolbar.tsx | 2 +- packages/ui/components/ConfirmDialog.tsx | 4 +- .../ui/components/ImageAnnotator/Toolbar.tsx | 2 +- packages/ui/components/Viewer.tsx | 8 +-- 7 files changed, 52 insertions(+), 31 deletions(-) diff --git a/packages/editor/App.tsx b/packages/editor/App.tsx index 9e496ee..c28ae46 100644 --- a/packages/editor/App.tsx +++ b/packages/editor/App.tsx @@ -627,8 +627,8 @@ const App: React.FC = () => { isSubmitting ? 'opacity-50 cursor-not-allowed bg-muted text-muted-foreground' : origin === 'claude-code' && annotations.length > 0 - ? 'bg-green-600/50 text-white/70 hover:bg-green-600 hover:text-white' - : 'bg-green-600 text-white hover:bg-green-500' + ? 'bg-success/50 text-success-foreground/70 hover:bg-success hover:text-success-foreground' + : 'bg-success text-success-foreground hover:opacity-90' }`} > {isSubmitting ? '...' : 'OK'} @@ -769,7 +769,7 @@ const App: React.FC = () => {
{submitted === 'approved' ? ( diff --git a/packages/editor/index.css b/packages/editor/index.css index 11ed9f4..f208209 100644 --- a/packages/editor/index.css +++ b/packages/editor/index.css @@ -6,25 +6,29 @@ @source "./*.tsx"; :root { - --background: oklch(0.13 0.02 260); - --foreground: oklch(0.95 0.01 260); - --card: oklch(0.16 0.02 260); - --card-foreground: oklch(0.95 0.01 260); - --popover: oklch(0.18 0.025 260); - --popover-foreground: oklch(0.95 0.01 260); + --background: oklch(0.15 0.02 260); + --foreground: oklch(0.90 0.01 260); + --card: oklch(0.22 0.02 260); + --card-foreground: oklch(0.90 0.01 260); + --popover: oklch(0.28 0.025 260); + --popover-foreground: oklch(0.90 0.01 260); --primary: oklch(0.75 0.18 280); - --primary-foreground: oklch(0.13 0.02 260); + --primary-foreground: oklch(0.15 0.02 260); --secondary: oklch(0.65 0.15 180); - --secondary-foreground: oklch(0.13 0.02 260); - --muted: oklch(0.22 0.02 260); - --muted-foreground: oklch(0.65 0.02 260); + --secondary-foreground: oklch(0.15 0.02 260); + --muted: oklch(0.26 0.02 260); + --muted-foreground: oklch(0.72 0.02 260); --accent: oklch(0.70 0.20 60); - --accent-foreground: oklch(0.13 0.02 260); - --destructive: oklch(0.65 0.22 25); + --accent-foreground: oklch(0.15 0.02 260); + --destructive: oklch(0.65 0.20 25); --destructive-foreground: oklch(0.98 0 0); - --border: oklch(0.28 0.02 260); - --input: oklch(0.22 0.02 260); + --border: oklch(0.35 0.02 260); + --input: oklch(0.26 0.02 260); --ring: oklch(0.75 0.18 280); + --success: oklch(0.72 0.17 150); + --success-foreground: oklch(0.15 0.02 260); + --warning: oklch(0.75 0.15 85); + --warning-foreground: oklch(0.20 0.02 260); --font-sans: 'Inter', system-ui, sans-serif; --font-mono: 'JetBrains Mono', 'Fira Code', monospace; @@ -51,6 +55,10 @@ --border: oklch(0.88 0.01 260); --input: oklch(0.92 0.01 260); --ring: oklch(0.50 0.25 280); + --success: oklch(0.45 0.20 150); + --success-foreground: oklch(1 0 0); + --warning: oklch(0.55 0.18 85); + --warning-foreground: oklch(0.18 0.02 260); } @theme inline { @@ -70,6 +78,10 @@ --color-accent-foreground: var(--accent-foreground); --color-destructive: var(--destructive); --color-destructive-foreground: var(--destructive-foreground); + --color-success: var(--success); + --color-success-foreground: var(--success-foreground); + --color-warning: var(--warning); + --color-warning-foreground: var(--warning-foreground); --color-border: var(--border); --color-input: var(--input); --color-ring: var(--ring); @@ -95,8 +107,8 @@ body { /* Subtle grid background */ .bg-grid { background-image: - linear-gradient(to right, oklch(0.25 0.02 260 / 0.5) 1px, transparent 1px), - linear-gradient(to bottom, oklch(0.25 0.02 260 / 0.5) 1px, transparent 1px); + linear-gradient(to right, oklch(0.32 0.02 260 / 0.5) 1px, transparent 1px), + linear-gradient(to bottom, oklch(0.32 0.02 260 / 0.5) 1px, transparent 1px); background-size: 24px 24px; } @@ -201,17 +213,26 @@ pre code.hljs { } .annotation-highlight.deletion { - background: oklch(0.65 0.22 25 / 0.25); + background: oklch(0.65 0.20 25 / 0.35); text-decoration: line-through; text-decoration-color: var(--destructive); text-decoration-thickness: 2px; } .annotation-highlight.comment { - background: oklch(0.70 0.20 60 / 0.2); + background: oklch(0.70 0.18 60 / 0.3); border-bottom: 2px solid var(--accent); } +/* Light mode: softer highlights */ +.light .annotation-highlight.deletion { + background: oklch(0.65 0.22 25 / 0.2); +} + +.light .annotation-highlight.comment { + background: oklch(0.70 0.20 60 / 0.15); +} + .annotation-highlight:hover { filter: brightness(1.2); cursor: pointer; diff --git a/packages/ui/components/AnnotationPanel.tsx b/packages/ui/components/AnnotationPanel.tsx index 500e9dc..db92235 100644 --- a/packages/ui/components/AnnotationPanel.tsx +++ b/packages/ui/components/AnnotationPanel.tsx @@ -172,8 +172,8 @@ const AnnotationCard: React.FC<{ }, [AnnotationType.GLOBAL_COMMENT]: { label: 'Global', - color: 'text-purple-500', - bg: 'bg-purple-500/10', + color: 'text-secondary', + bg: 'bg-secondary/10', icon: ( diff --git a/packages/ui/components/AnnotationToolbar.tsx b/packages/ui/components/AnnotationToolbar.tsx index 4f2a5cf..cde89c4 100644 --- a/packages/ui/components/AnnotationToolbar.tsx +++ b/packages/ui/components/AnnotationToolbar.tsx @@ -162,7 +162,7 @@ export const AnnotationToolbar: React.FC = ({ onClick={handleCopy} icon={copied ? : } label={copied ? "Copied!" : "Copy"} - className={copied ? "text-green-500" : "text-muted-foreground hover:bg-muted hover:text-foreground"} + className={copied ? "text-success" : "text-muted-foreground hover:bg-muted hover:text-foreground"} />
= ({ const iconColors = { info: 'bg-accent/20 text-accent', - warning: 'bg-yellow-500/20 text-yellow-500', + warning: 'bg-warning/20 text-warning', }; const buttonColors = { info: 'bg-primary text-primary-foreground hover:opacity-90', - warning: 'bg-yellow-600 text-white hover:bg-yellow-500', + warning: 'bg-warning text-warning-foreground hover:opacity-90', }; const icons = { diff --git a/packages/ui/components/ImageAnnotator/Toolbar.tsx b/packages/ui/components/ImageAnnotator/Toolbar.tsx index 4308b6a..619ea86 100644 --- a/packages/ui/components/ImageAnnotator/Toolbar.tsx +++ b/packages/ui/components/ImageAnnotator/Toolbar.tsx @@ -209,7 +209,7 @@ export const Toolbar: React.FC = ({ type="button" onClick={onSave} title="Save (Esc)" - className="p-1.5 rounded transition-colors bg-green-600 text-white hover:bg-green-500" + className="p-1.5 rounded transition-colors bg-success text-success-foreground hover:opacity-90" > diff --git a/packages/ui/components/Viewer.tsx b/packages/ui/components/Viewer.tsx index 521ee0c..958b6d3 100644 --- a/packages/ui/components/Viewer.tsx +++ b/packages/ui/components/Viewer.tsx @@ -606,7 +606,7 @@ export const Viewer = forwardRef(({ @@ -644,7 +644,7 @@ export const Viewer = forwardRef(({ > {copied ? ( <> - + Copied! @@ -872,7 +872,7 @@ const BlockRenderer: React.FC<{ block: Block }> = ({ block }) => { {isCheckbox ? ( block.checked ? ( - + ) : ( @@ -999,7 +999,7 @@ const CodeBlock: React.FC = ({ block, onHover, onLeave, isHovere title={copied ? 'Copied!' : 'Copy code'} > {copied ? ( - + ) : ( -- knotmirror 0.0.1