Skip to content

Commit 8f0fb0a

Browse files
thephezclaude
andauthored
fix(dashproof-lab): make success/error notices and toasts readable in light theme (#76)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent fb19a9c commit 8f0fb0a

4 files changed

Lines changed: 25 additions & 4 deletions

File tree

example-apps/dashproof-lab/src/App.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { OperationResultNotice } from "./components/OperationResultNotice";
1111
import { VerifyPanel } from "./components/VerifyPanel";
1212
import type { TopTab } from "./components/Tabs";
1313
import { useSession } from "./session/useSession";
14+
import { useTheme } from "./hooks/useTheme";
1415

1516
const screenCopy: Record<TopTab, { title: string; subtitle: string }> = {
1617
anchor: {
@@ -35,6 +36,7 @@ const screenCopy: Record<TopTab, { title: string; subtitle: string }> = {
3536

3637
function App() {
3738
const session = useSession();
39+
const { theme } = useTheme();
3840
const { status, enterReadOnly } = session;
3941
const [tab, setTab] = useState<TopTab>("anchor");
4042
const [loginOpen, setLoginOpen] = useState(false);
@@ -57,7 +59,7 @@ function App() {
5759

5860
return (
5961
<>
60-
<Toaster position="bottom-center" />
62+
<Toaster position="bottom-center" theme={theme} richColors />
6163
<AppShell
6264
tab={tab}
6365
onTabChange={setTab}

example-apps/dashproof-lab/src/components/OperationResultNotice.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ const toneClass: Record<
1111
string
1212
> = {
1313
info: "border-line bg-surface text-ink-2",
14-
success: "border-[oklch(38%_0.08_150)] bg-[oklch(24%_0.03_150)] text-ink",
14+
success:
15+
"border-[var(--color-success-border)] bg-[var(--color-success-bg)] text-[var(--color-success-fg)]",
1516
error:
16-
"border-[oklch(30%_0.08_25)] bg-[oklch(22%_0.04_25)] text-[oklch(84%_0.08_25)]",
17+
"border-[var(--color-error-border)] bg-[var(--color-error-bg)] text-[var(--color-error-fg)]",
1718
};
1819

1920
export function OperationResultNotice({

example-apps/dashproof-lab/src/hooks/useTheme.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,11 @@ export function __resetThemeStoreForTests(): void {
5858
}
5959

6060
export function useTheme() {
61-
const theme = useSyncExternalStore(subscribe, readCurrent, () => "dark");
61+
const theme = useSyncExternalStore<Theme>(
62+
subscribe,
63+
readCurrent,
64+
() => "dark",
65+
);
6266

6367
const setTheme = useCallback((next: Theme) => {
6468
setThemeStore(next);

example-apps/dashproof-lab/src/styles/globals.css

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@
1717
--color-accent-dim: #016fbd;
1818
--color-danger: oklch(68% 0.2 25);
1919

20+
--color-success-bg: oklch(24% 0.03 150);
21+
--color-success-border: oklch(38% 0.08 150);
22+
--color-success-fg: oklch(96% 0.008 90);
23+
--color-error-bg: oklch(22% 0.04 25);
24+
--color-error-border: oklch(30% 0.08 25);
25+
--color-error-fg: oklch(84% 0.08 25);
26+
2027
--font-sans:
2128
"Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
2229
--font-mono:
@@ -43,6 +50,13 @@
4350
--color-ink-4: oklch(62% 0.012 260);
4451

4552
--color-danger: oklch(55% 0.22 25);
53+
54+
--color-success-bg: oklch(95% 0.04 150);
55+
--color-success-border: oklch(75% 0.12 150);
56+
--color-success-fg: oklch(28% 0.08 150);
57+
--color-error-bg: oklch(96% 0.03 25);
58+
--color-error-border: oklch(78% 0.14 25);
59+
--color-error-fg: oklch(35% 0.15 25);
4660
}
4761

4862
html,

0 commit comments

Comments
 (0)