Skip to content

feat(demo): modernized styles with swappable palettes and runtime theme switcher#1371

Open
sserrata wants to merge 18 commits intomainfrom
feat/glean-inspired-styles
Open

feat(demo): modernized styles with swappable palettes and runtime theme switcher#1371
sserrata wants to merge 18 commits intomainfrom
feat/glean-inspired-styles

Conversation

@sserrata
Copy link
Copy Markdown
Member

Summary

  • Restructures demo/src/css/ into a theme-contract model: custom.css owns all structural styles (badge shapes, sidebar behavior, animations, typography rules) with zero color/font declarations, keeping it theme-agnostic
  • Adds 7 handcrafted color palettes under demo/src/css/themes/ — each file is a self-contained drop-in that implements the CSS variable contract (--ifm-color-primary-*, --theme-primary-rgb, --site-primary-hue-saturation, etc.):
    • panw — PANW brand navy, Plus Jakarta Sans + Fira Code
    • evergreen — modernized classic Docusaurus green, Plus Jakarta Sans + Fira Code
    • violet — Violet-600 primary, Space Grotesk + JetBrains Mono
    • midnight — Slate-900 base, sky-blue accent, Inter + JetBrains Mono
    • indigo — Zinc-950 base, Indigo-500 accent, Geist + Geist Mono (shadcn/ui aesthetic)
    • nord — faithful Nord palette (Polar Night base, Frost accent, Aurora method badges)
    • cyber — neon green on near-black, JetBrains Mono everywhere including body/headings
  • Adds a runtime PalettePicker navbar dropdown that injects the selected /themes/<id>.css dynamically, persists the choice in localStorage, and restores it via an inline <head> script (FOUC prevention)
  • Fixes badge color consistency — sidebar method pills and API page badge--* classes now match in all themes
  • Fixes send button dark mode contrast — pins the Explorer request button to each theme's solid primary in dark mode
  • Fixes API Explorer body editor font size — explicitly applies --openapi-explorer-font-size-code to the react-simple-code-editor inner textarea and pre elements in the evergreen theme

Test plan

  • Start demo: cd demo && yarn start
  • Palette picker appears in navbar (right side, before icon links)
  • Selecting each of the 7 palettes applies instantly with no page reload
  • Selected palette persists across page navigation and browser refresh
  • Light ↔ dark mode toggle works correctly in all 7 palettes
  • Sidebar method badge colors match the API page badge pills in each theme
  • Send button is legible in dark mode across all themes
  • No regressions in existing API Explorer behavior

🤖 Generated with Claude Code

sserrata and others added 15 commits March 30, 2026 18:14
- Replace default Docusaurus green with Glean blue (#343ced) primary palette
- Add Inter font for body text, JetBrains Mono for code
- Full dark mode with navy base (#111827) and gray emphasis scale
- Modernize HTTP method badges: pill-style with translucent inactive /
  solid active states, dark mode variants for all methods
- Port sidebar behavior: transparent hover, uppercase top-level
  categories, active item uses primary color (no background fill)
- Add schema parameter highlight-flash animation on anchor target
- Add custom scrollbar styling for code tab panels
- Add border-radius and shadow scale variables
- Add grid utility classes
- Port admonition border removal + border-radius
- Enable prismThemes.github/dracula for code blocks
- Add colorMode.respectPrefersColorScheme: true
- Remove navbar title text (logo-only nav)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
MethodEndpoint uses .badge--primary/success/danger/info/warning which
map to different Infima colors than the sidebar ::before pseudo-elements.
Override all badge classes to use the same color scheme:
  GET    → badge--primary → green  (#16a34a / #22c55e dark)
  POST   → badge--success → navy   (#004c9d / #5eb7ff dark)
  DELETE → badge--danger  → red    (#dc2626 / #ef4444 dark)
  PUT    → badge--info    → amber  (#d97706 / #f59e0b dark)
  PATCH  → badge--warning → amber  (#d97706 / #f59e0b dark)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
--ifm-color-primary-light resolves to #acd9ff in dark mode, making
white text nearly invisible. Pin the request button to PANW navy
(#004c9d) in dark mode to ensure readable contrast.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
custom.css is now purely structural (layout, animations, utilities).
All colors, fonts, and palette-specific values live in a theme file.

To try a different palette, swap one line in docusaurus.config.ts:
  customCss: ["./src/css/custom.css", "./src/css/themes/<theme>.css"]

themes/panw.css — Palo Alto Networks brand (pan.dev):
  - Plus Jakarta Sans + Fira Code fonts
  - PANW navy primary (#004c9d), orange accent (#fa582d)
  - Near-black dark mode (#0b1117) with steel-blue gray scale
  - Method badge colors, .badge--* overrides, send button fix

custom.css changes:
  - Uses --theme-primary-rgb for the highlight-flash animation
  - Uses --theme-border-radius-sm/md with fallback defaults
  - Badge content labels separated from colors (colors in theme)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds demo/src/css/themes/violet.css (Space Grotesk + JetBrains Mono,
Violet-600 primary, deep purple-tinted dark mode) and switches
docusaurus.config.ts to load it instead of panw.css.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds demo/src/css/themes/cyber.css — neon green (#00ff88) on near-black
(#030a06), monospace (JetBrains Mono) everywhere including body and
headings, electric cyan POST badges, hot pink DELETE badges in dark mode,
and sharp 2-4px border radii throughout.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds demo/src/css/themes/midnight.css — slate-900 (#0f172a) base with
sky-blue (#38bdf8) accents, Inter body font, JetBrains Mono code. Active
badges use dark text on bright fills for contrast on the slate background.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds demo/src/css/themes/indigo.css — the modern dev site aesthetic.
Zinc-950 (#09090b) dark base, indigo-500 (#6366f1) accent, Geist +
Geist Mono font stack. Neutral shadows (no color tint), subtle badge
opacity, matches the shadcn/ui + Linear + Clerk visual language.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds demo/src/css/themes/nord.css — faithful to the Nord color palette
(Arctic Ice Studio). Polar Night (#2e3440) dark base, Frost blue-cyan
(#88c0d0) primary, Aurora semantic colors for method badges throughout.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds demo/src/css/themes/evergreen.css — a modern riff on the classic
Docusaurus green (#2e8555). Keeps the signature primary, upgrades to
Plus Jakarta Sans + Fira Code, deepens the dark mode to #18191a, and
applies neutral shadows throughout.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Overrides --openapi-explorer-font-size-code from the 12px default
to 14px for better readability in the request body example panel.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…size

Uses var(--ifm-code-font-size) instead of a hardcoded pixel value so the
request body panel always matches the code snippet blocks.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sets --openapi-explorer-font-size-code to 13px and explicitly applies
it to .openapi-explorer__playground-editor plus its inner textarea and
pre elements, which react-simple-code-editor renders outside the reach
of the outer font shorthand.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Moves all theme CSS to demo/static/themes/ for URL-accessible dynamic
loading. Registers a custom-PalettePicker navbar item that injects the
selected /themes/<id>.css at runtime, persists the choice in
localStorage, and restores it on reload via an inline <head> script.
ComponentTypes swizzle was silently not loading. Replacing it with a
NavbarItem/index wrapper that intercepts custom-PalettePicker before
the ComponentTypes lookup, which is more reliable across Docusaurus
theme chain configurations.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 30, 2026

Size Change: +33.7 kB (+1.52%)

Total Size: 2.26 MB

Filename Size Change
demo/.docusaurus/docusaurus.config.mjs 16.1 kB +1.39 kB (+9.44%) 🔍
demo/.docusaurus/site-metadata.json 1.57 kB +58 B (+3.83%)
demo/build/assets/css/styles.********.css 170 kB +6.63 kB (+4.05%)
demo/build/assets/js/main.********.js 668 kB +3.62 kB (+0.54%)
demo/build/index.html 95.8 kB -1.79 kB (-1.84%)
demo/build/petstore/add-pet/index.html 30 kB +686 B (+2.34%)
demo/build/petstore/create-user/index.html 24.7 kB +729 B (+3.04%)
demo/build/petstore/create-users-with-array-input/index.html 24.8 kB +729 B (+3.03%)
demo/build/petstore/create-users-with-list-input/index.html 24.8 kB +729 B (+3.03%)
demo/build/petstore/delete-order/index.html 24.6 kB +729 B (+3.06%)
demo/build/petstore/delete-pet/index.html 24.8 kB +729 B (+3.02%)
demo/build/petstore/delete-user/index.html 25 kB +729 B (+3%)
demo/build/petstore/find-pets-by-status/index.html 25.5 kB +729 B (+2.94%)
demo/build/petstore/find-pets-by-tags/index.html 26.2 kB +729 B (+2.87%)
demo/build/petstore/get-inventory/index.html 23.8 kB +729 B (+3.15%)
demo/build/petstore/get-order-by-id/index.html 24.8 kB +729 B (+3.03%)
demo/build/petstore/get-pet-by-id/index.html 25.6 kB +729 B (+2.93%)
demo/build/petstore/get-user-by-name/index.html 25.1 kB +729 B (+2.99%)
demo/build/petstore/login-user/index.html 25.7 kB +729 B (+2.92%)
demo/build/petstore/logout-user/index.html 24.4 kB +729 B (+3.08%)
demo/build/petstore/new-pet/index.html 25 kB +729 B (+3%)
demo/build/petstore/pet/index.html 23.2 kB +729 B (+3.24%)
demo/build/petstore/place-order/index.html 24.1 kB +729 B (+3.12%)
demo/build/petstore/schemas/apiresponse/index.html 25.3 kB +659 B (+2.68%)
demo/build/petstore/schemas/cat/index.html 39.1 kB +385 B (+0.99%)
demo/build/petstore/schemas/category/index.html 26.3 kB +640 B (+2.49%)
demo/build/petstore/schemas/dog/index.html 39.3 kB +347 B (+0.89%)
demo/build/petstore/schemas/honeybee/index.html 39.4 kB +347 B (+0.89%)
demo/build/petstore/schemas/id/index.html 23.4 kB +716 B (+3.15%)
demo/build/petstore/schemas/order/index.html 27.4 kB +603 B (+2.25%)
demo/build/petstore/schemas/pet/index.html 38.9 kB +366 B (+0.95%)
demo/build/petstore/schemas/tag/index.html 24.7 kB +678 B (+2.82%)
demo/build/petstore/schemas/user/index.html 40.8 kB +195 B (+0.48%)
demo/build/petstore/store/index.html 22.2 kB +729 B (+3.39%)
demo/build/petstore/subscribe-to-the-store-events/index.html 30.9 kB +729 B (+2.41%)
demo/build/petstore/swagger-petstore-yaml/index.html 30.9 kB +729 B (+2.41%)
demo/build/petstore/update-pet-with-form/index.html 25 kB +729 B (+3.01%)
demo/build/petstore/update-pet/index.html 25.4 kB +729 B (+2.95%)
demo/build/petstore/update-user/index.html 25 kB +729 B (+3%)
demo/build/petstore/upload-file/index.html 24.8 kB +729 B (+3.02%)
demo/build/petstore/user/index.html 22.9 kB +729 B (+3.28%)
ℹ️ View Unchanged
Filename Size
demo/.docusaurus/codeTranslations.json 2 B
demo/.docusaurus/globalData.json 68.6 kB
demo/.docusaurus/i18n.json 372 B
demo/.docusaurus/registry.js 99.3 kB
demo/.docusaurus/routes.js 93.8 kB
demo/.docusaurus/routesChunkNames.json 39 kB
demo/build/assets/js/runtime~main.********.js 23.1 kB

compressed-size-action

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 30, 2026

Visit the preview URL for this PR (updated for commit 73a1008):

https://docusaurus-openapi-36b86--pr1371-nb7rklqm.web.app

(expires Thu, 30 Apr 2026 13:15:51 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: bf293780ee827f578864d92193b8c2866acd459f

sserrata and others added 3 commits March 30, 2026 20:02
The component already returns null for mobile={true} (drawer), but
Docusaurus also renders right-side navbar items in the collapsed mobile
top bar without that prop. Hide .root below 996px to match Docusaurus's
own navbar collapse breakpoint.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
On mobile (≤996px):
- Trigger collapses to a 36px circular swatch-only button (no text/chevron)
  that fits cleanly in the navbar top bar
- Dropdown becomes a fixed bottom sheet with rounded top corners, a drag
  handle indicator, and larger touch targets (12px padding per row)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Desktop: unchanged pill button + dropdown in the top bar.
Mobile: top-bar button hidden; instead renders a 2-column grid of
labeled color swatches inside the hamburger drawer (mobile={true})
with active-state border highlight and a section heading.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant