Skip to content

Commit d9832b7

Browse files
Pin light theme inside .ws-force-light on /workspaces/ (#772)
The earlier force-light approach (adding the `.light` class to <html> from a head script) gets undone the moment the React ModeToggleIsland hydrates: its mount effect always calls `classList.remove('light')` before re-applying based on the saved cookie. If the visitor's saved theme is dark, the page flashes light then flips to dark. Inline the light theme tokens inside `.ws-force-light` instead. The toggle component can still flip the global `.light` class on/off, but the workspaces page's tokens are pinned at the wrapper scope and unaffected. Result: deterministic light mode regardless of the visitor's saved preference. Generated with [Devin](https://cli.devin.ai/docs) Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent 93e8b5d commit d9832b7

1 file changed

Lines changed: 35 additions & 7 deletions

File tree

apps/marketing/src/pages/workspaces/index.astro

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,43 @@ const teamSizes = [
2626
description="Plannotator Workspaces is the hosted team layer for collaborating on agent plans, specs, code reviews, and verification standards. Plannotator core stays free and open source."
2727
>
2828
<Fragment slot="head">
29-
<!-- Force light mode on this page only. The Base.astro cookie-reader
30-
only ADDS the `.light` class (never removes), so this `add` runs
31-
before paint and any saved-dark setting won't undo it. -->
32-
<script is:inline>
33-
document.documentElement.classList.add('light');
34-
</script>
29+
<!-- Force light mode on this page only. We pin the light-theme tokens
30+
directly inside `.ws-force-light` rather than relying on the
31+
global `.light` class — the Nav's ModeToggleIsland hydrates a
32+
React effect that calls `classList.remove('light')` on mount,
33+
which would otherwise undo any earlier force-light attempt. */ -->
34+
<style>
35+
.ws-force-light {
36+
--background: oklch(0.97 0.005 260);
37+
--foreground: oklch(0.18 0.02 260);
38+
--card: oklch(1 0 0);
39+
--card-foreground: oklch(0.18 0.02 260);
40+
--popover: oklch(1 0 0);
41+
--popover-foreground: oklch(0.18 0.02 260);
42+
--primary: oklch(0.50 0.25 280);
43+
--primary-foreground: oklch(1 0 0);
44+
--secondary: oklch(0.50 0.18 180);
45+
--secondary-foreground: oklch(1 0 0);
46+
--muted: oklch(0.92 0.01 260);
47+
--muted-foreground: oklch(0.40 0.02 260);
48+
--accent: oklch(0.60 0.22 50);
49+
--accent-foreground: oklch(0.18 0.02 260);
50+
--destructive: oklch(0.50 0.25 25);
51+
--destructive-foreground: oklch(1 0 0);
52+
--border: oklch(0.88 0.01 260);
53+
--input: oklch(0.92 0.01 260);
54+
--ring: oklch(0.50 0.25 280);
55+
--success: oklch(0.45 0.20 150);
56+
--success-foreground: oklch(1 0 0);
57+
--warning: oklch(0.55 0.18 85);
58+
--warning-foreground: oklch(0.18 0.02 260);
59+
--code-bg: oklch(0.92 0.01 260);
60+
color-scheme: light;
61+
}
62+
</style>
3563
</Fragment>
3664

37-
<div class="min-h-screen bg-background text-foreground">
65+
<div class="ws-force-light min-h-screen bg-background text-foreground">
3866
<Nav />
3967

4068
<!-- Two independent flex columns so the hero (top of left column) and

0 commit comments

Comments
 (0)