Skip to content

fix: enhance dark theme support for Visualizer and DocsLayout components#5507

Open
hasithasandunlakshan wants to merge 4 commits into
asyncapi:website-uifrom
hasithasandunlakshan:fix/spec-explorer-dark-theme-website-ui
Open

fix: enhance dark theme support for Visualizer and DocsLayout components#5507
hasithasandunlakshan wants to merge 4 commits into
asyncapi:website-uifrom
hasithasandunlakshan:fix/spec-explorer-dark-theme-website-ui

Conversation

@hasithasandunlakshan
Copy link
Copy Markdown

@hasithasandunlakshan hasithasandunlakshan commented May 28, 2026

Description

  • Adds dark theme support for the AsyncAPI Specification Explorer pages.
  • Applies existing docs dark-theme styling to explorer routes such as /docs/reference/specification/v3.1.0-explorer.
  • Adds scoped dark-mode overrides for Schyma/React Flow generated elements, including nodes, side panel, tables, tabs, controls, and JSON examples.
  • Keeps light theme behavior unchanged by relying on Schyma's default styles.
  • Adds a narrow TypeScript declaration for schyma/dist/esm/style.css.

Reproduction Guidelines

  1. Open the Specification Explorer page:
  1. Test in light theme:

    • Confirm the explorer keeps the existing light appearance.
    • Confirm schema nodes, the side panel, tables, tabs, and JSON examples render correctly.
  2. Switch to dark theme.

  3. Test in dark theme:

    • Confirm the explorer background follows the docs dark theme.
    • Confirm all schema nodes are readable.
    • Confirm the side panel uses dark colors.
    • Confirm Examples/JSON blocks use dark code styling.
    • Confirm the docs menu popover remains readable.

Screenshots

Light Theme Comparison

Before After
Light Theme Before 01 Light Theme After 01
Light Theme Before 02 Light Theme After 02

Dark Theme Comparison

Before After
Dark Theme Before 01 Dark Theme After 01
Dark Theme Before 02 Dark Theme After 02

Summary by CodeRabbit

  • Style
    • Added comprehensive dark mode styling for the schema visualizer (panels, controls, tokens, syntax highlighting).
    • Enhanced dark mode support for the documentation explorer menu and menu icon.
    • Applied schema-visualizer CSS class to visualizer container.
  • Chores
    • Added a TypeScript ambient declaration to enable importing the external stylesheet.
  • Other
    • Simplified article wrapper markup in docs layout.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

📝 Walkthrough

Walkthrough

Adds dark-mode support: a TypeScript CSS module declaration, minor component class updates to opt into the stylesheet, and extensive dark-theme CSS for the schema visualizer and explorer menu.

Changes

Dark Mode Styling for Schema Visualizer and Explorer Layout

Layer / File(s) Summary
TypeScript CSS module declaration
types/packages/css.d.ts
Adds ambient declare module 'schyma/dist/esm/style.css' to allow importing that stylesheet in TypeScript.
Component markup updates
components/docs/Visualizer.tsx, components/layout/DocsLayout.tsx
Visualizer container adds schema-visualizer class; DocsLayout explorer branch updates Menu button classes for dark mode, updates IconMenuCenter fill class, and removes an empty className from the article wrapper.
Dark-mode stylesheet rules
styles/globals.css
Adds dark-mode overrides for .explorer-menu-wrapper and extensive .schema-visualizer dark theme (panels, tabs, table sections, React Flow controls/nodes, and detailed token color rules).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • derberg
  • princerajpoot20
  • akshatnema
  • sambhavgupta0705
  • anshgoyalevil
  • Mayaleeeee
  • asyncapi-bot-eve

Poem

🐇 I dug a tunnel through the night,

to paint the schemas soft and slight.
Dark panels hum with muted gleam,
Nodes and tokens whisper dream—
A rabbit's glow for docs at night.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding dark theme support to Visualizer and DocsLayout components, which is reflected across all modified files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed: dependency version conflict. Check your lock file or package.json.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 28, 2026

Deploy Preview for asyncapi-website ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 6660517
🔍 Latest deploy log https://app.netlify.com/projects/asyncapi-website/deploys/6a199740557cc20007b4eb3f
😎 Deploy Preview https://deploy-preview-5507--asyncapi-website.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (0064e5f) to head (6660517).
⚠️ Report is 3 commits behind head on website-ui.

Additional details and impacted files
@@             Coverage Diff              @@
##           website-ui     #5507   +/-   ##
============================================
  Coverage      100.00%   100.00%           
============================================
  Files              23        23           
  Lines             931       931           
  Branches          180       180           
============================================
  Hits              931       931           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@hasithasandunlakshan hasithasandunlakshan force-pushed the fix/spec-explorer-dark-theme-website-ui branch from b7cc983 to 6d87dca Compare May 28, 2026 13:53
@hasithasandunlakshan
Copy link
Copy Markdown
Author

@CodeRabbit Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

Actionable comments posted: 0

@hasithasandunlakshan
Copy link
Copy Markdown
Author

@princerajpoot20

@sammy200-ui
Copy link
Copy Markdown
Contributor

sammy200-ui commented May 28, 2026

Screenshot 2026-05-28 at 8 42 34 PM

should we not follow the same theme here as well ?? like we are doing on the landing page

Screenshot 2026-05-28 at 8 42 10 PM

@sammy200-ui
Copy link
Copy Markdown
Contributor

Screenshot 2026-05-28 at 8 45 08 PM the zoom in and out button could be improved

@hasithasandunlakshan
Copy link
Copy Markdown
Author

Screenshot 2026-05-28 at 8 45 08 PM the zoom in and out button could be improved

Screenshot 2026-05-28 at 21 51 20

@hasithasandunlakshan
Copy link
Copy Markdown
Author

hasithasandunlakshan commented May 28, 2026

Screenshot 2026-05-28 at 8 42 34 PM should we not follow the same theme here as well ?? like we are doing on the landing page Screenshot 2026-05-28 at 8 42 10 PM

@princerajpoot20 what is your idea. because light theme we have some diffrence.
Uploading Screenshot 2026-05-28 at 22.07.22.png…

Copy link
Copy Markdown
Member

@princerajpoot20 princerajpoot20 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#5507 (comment) Good point @sammy200-ui

@hasithasandunlakshan can you please have a look at this. the black is not going well with the theme

@hasithasandunlakshan
Copy link
Copy Markdown
Author

#5507 (comment) Good point @sammy200-ui

@hasithasandunlakshan can you please have a look at this. the black is not going well with the theme

Hey in light theme we have not same styles in home page and this page

  • Home page json view
Screenshot 2026-05-28 at 22 07 32 - Explorer json view Screenshot 2026-05-28 at 22 07 22

@hasithasandunlakshan
Copy link
Copy Markdown
Author

#5507 (comment) Good point @sammy200-ui
@hasithasandunlakshan can you please have a look at this. the black is not going well with the theme

Hey in light theme we have not same styles in home page and this page

  • Home page json view

Screenshot 2026-05-28 at 22 07 32 - Explorer json view Screenshot 2026-05-28 at 22 07 22

@princerajpoot20 @sammy200-ui what do you think ? Should we change light theme as well ?

@hasithasandunlakshan
Copy link
Copy Markdown
Author

Screenshot 2026-05-28 at 23 17 07

Hi @princerajpoot20 I feel this is good for dark theme.If we use home page colors we should change background colors as well.

@hasithasandunlakshan
Copy link
Copy Markdown
Author

Final one.
Screenshot 2026-05-28 at 23 53 18

Comment thread types/packages/css.d.ts
@@ -0,0 +1 @@
declare module 'schyma/dist/esm/style.css';
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hasithasandunlakshan
what is the purpose this file solves?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Baiscally it resolves typescript errors.If we remove this it gives
    Cannot find module 'schyma/dist/esm/style.css' or its corresponding type declarations.
    The issue is in Visualizer.tsx is import schyma/dist/esm/style.css. But since visualizer.tsx is type script file it expects css file as a typescript file.

Adding this type declare it is fixing above issue.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hasithasandunlakshan what is the purpose this file solves?

  • Baiscally it resolves typescript errors.If we remove this it gives
    Cannot find module 'schyma/dist/esm/style.css' or its corresponding type declarations.
    The issue is in Visualizer.tsx is import schyma/dist/esm/style.css. But since visualizer.tsx is type script file it expects css file as a typescript file.

Adding this type declare it is fixing above issue.

@hasithasandunlakshan hasithasandunlakshan force-pushed the fix/spec-explorer-dark-theme-website-ui branch from 523508d to 6660517 Compare May 29, 2026 13:40
@sonarqubecloud
Copy link
Copy Markdown

@sammy200-ui
Copy link
Copy Markdown
Contributor

@coderabbitai full review once again

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 30, 2026

@sammy200-ui Sure, triggering a full review of this PR now!

✅ Actions performed

Full review triggered.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
styles/globals.css (2)

437-461: 💤 Low value

Consider the maintenance risk of tightly coupled selectors.

These selectors (e.g., .dark .schema-visualizer .panel, .dark .schema-visualizer .custom-node) are tightly coupled to the internal DOM structure and class names generated by the Schyma library. If Schyma updates its component structure or class naming in a future release, these styles may break silently.

While this approach works for the current version, consider requesting or contributing CSS custom properties (CSS variables) to the Schyma library for theming. This would provide a more stable API for customization that isn't tied to internal implementation details.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@styles/globals.css` around lines 437 - 461, These deeply nested selectors
(.dark .schema-visualizer .panel, .dark .schema-visualizer .custom-node,
.react-flow__node-*, etc.) couple the theme to Schyma's internal DOM; instead,
define a small set of CSS custom properties on the component root
(.schema-visualizer and .dark .schema-visualizer) such as --sv-bg, --sv-color,
--sv-panel-bg, --sv-border-color and use those variables in your existing
internal rules (or prefer only single-level selectors referencing the root
vars); if Schyma supports or can be extended to expose theme variables, migrate
to those library-provided vars and remove deep class-specific overrides to
reduce fragility when Schyma changes.

522-565: ⚖️ Poor tradeoff

Fragile color overrides using !important and inline style selectors.

The use of !important flags (lines 528-529, 535-536, 540-564) and attribute selectors targeting inline styles (lines 543-545, 551-553) suggests that the Schyma library applies inline styles with high specificity. This approach works but is fragile:

  1. !important proliferation makes future style adjustments harder and creates specificity wars
  2. Inline style attribute selectors like span[style*="color: rgb(153, 0, 85)"] will break if the library:
    • Changes the RGB values
    • Uses hex, hsl, or CSS custom properties instead
    • Applies colors differently

If Schyma exposes theming hooks or CSS custom properties, migrate to those. Otherwise, document this brittleness and monitor for Schyma updates that might change color application.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@styles/globals.css` around lines 522 - 565, The overrides under .dark
.schema-visualizer .examples-code-container are fragile because they rely on
!important and fragile attribute selectors (e.g., span[style*="color: rgb(153,
0, 85)"])—replace them by using the library’s theming hooks or CSS custom
properties where possible (map the colors to variables like --sv-bg, --sv-text,
--sv-keyword and consume those in .schema-visualizer rules), remove !important
once variables/hooks are applied, and instead increase selector specificity only
if needed (e.g., scope under .schema-visualizer and targeted token classes:
.token, .token.property, .token.string, .token.operator, .token.number,
.token.boolean, .token.null). If Schyma/theming hooks aren’t available, add a
short inline comment documenting the brittleness and use safer selectors (avoid
exact inline style matching; prefer token class names) and centralize the
override colors into CSS variables so future changes are easier to update.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@styles/globals.css`:
- Around line 437-461: These deeply nested selectors (.dark .schema-visualizer
.panel, .dark .schema-visualizer .custom-node, .react-flow__node-*, etc.) couple
the theme to Schyma's internal DOM; instead, define a small set of CSS custom
properties on the component root (.schema-visualizer and .dark
.schema-visualizer) such as --sv-bg, --sv-color, --sv-panel-bg,
--sv-border-color and use those variables in your existing internal rules (or
prefer only single-level selectors referencing the root vars); if Schyma
supports or can be extended to expose theme variables, migrate to those
library-provided vars and remove deep class-specific overrides to reduce
fragility when Schyma changes.
- Around line 522-565: The overrides under .dark .schema-visualizer
.examples-code-container are fragile because they rely on !important and fragile
attribute selectors (e.g., span[style*="color: rgb(153, 0, 85)"])—replace them
by using the library’s theming hooks or CSS custom properties where possible
(map the colors to variables like --sv-bg, --sv-text, --sv-keyword and consume
those in .schema-visualizer rules), remove !important once variables/hooks are
applied, and instead increase selector specificity only if needed (e.g., scope
under .schema-visualizer and targeted token classes: .token, .token.property,
.token.string, .token.operator, .token.number, .token.boolean, .token.null). If
Schyma/theming hooks aren’t available, add a short inline comment documenting
the brittleness and use safer selectors (avoid exact inline style matching;
prefer token class names) and centralize the override colors into CSS variables
so future changes are easier to update.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 2903588b-75ac-4cac-b794-fa2abd9cd898

📥 Commits

Reviewing files that changed from the base of the PR and between 0064e5f and 6660517.

📒 Files selected for processing (4)
  • components/docs/Visualizer.tsx
  • components/layout/DocsLayout.tsx
  • styles/globals.css
  • types/packages/css.d.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: To Be Triaged

Development

Successfully merging this pull request may close these issues.

3 participants