System default dark mode#92
Conversation
Signed-off-by: kumaradityaraj <sedulous.0007@gmail.com>
|
@kumaradityaraj Thanks for the PR. Looks like this only handles the first part of ticket for system default but the second part needs to be done "implement an attribute in the component to override this behaviour and force a specific theme" |
Signed-off-by: kumaradityaraj <sedulous.0007@gmail.com>
There was a problem hiding this comment.
Pull request overview
Implements theme switching for the diagram editor by wiring React Flow’s colorMode to a new state (defaulting to system), and removes the previous hardcoded diagram background styling.
Changes:
- Add
colorMode="system"support to@xyflow/reactReactFlowvia component state. - Add a UI
<select>to manually switch betweendark,light, andsystem. - Remove
.diagram-backgroundstyling from the diagram CSS; add a test-run artifact file.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| packages/serverless-workflow-diagram-editor/src/react-flow/diagram/Diagram.tsx | Adds colorMode state, passes it to ReactFlow, and introduces a theme dropdown UI. |
| packages/serverless-workflow-diagram-editor/src/react-flow/diagram/Diagram.css | Removes background styling previously applied via .diagram-background. |
| packages/serverless-workflow-diagram-editor/test-results/.last-run.json | Adds last test run result artifact. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@fantonangeli |
|
@kumaradityaraj I was thinking about:
|
Signed-off-by: kumaradityaraj <sedulous.0007@gmail.com>
Signed-off-by: kumaradityaraj <sedulous.0007@gmail.com>
Signed-off-by: kumaradityaraj <sedulous.0007@gmail.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: kumaradityaraj <sedulous.0007@gmail.com>
Signed-off-by: fantonangeli <fabrizio.antonangeli@gmail.com>
Use sand flow background
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: kumaradityaraj <sedulous.0007@gmail.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @media (prefers-color-scheme: dark) { | ||
| .diagram-background{ | ||
| --xy-background-pattern-color: inherit; | ||
| background-color: inherit; | ||
| } | ||
| } |
There was a problem hiding this comment.
The dark-mode styling here is driven solely by @media (prefers-color-scheme: dark), which means the new colorMode prop cannot force dark mode when the system is light (and vice-versa). To support the intended override behavior, base these styles on an explicit class/data-attribute that reflects the resolved colorMode (and only fall back to prefers-color-scheme when colorMode === "system").
There was a problem hiding this comment.
@fantonangeli I think it is true to some extent because with the current implementation this feature is breaking if we are playng with the attribute of storybook. Can you suggest something here?
| .headingContent { | ||
| color: #000000; | ||
| background-color: #F8F8F8; | ||
| margin: 0; | ||
| padding: 1%; | ||
| } | ||
|
|
||
| @media (prefers-color-scheme: dark) { | ||
| .headingContent { | ||
| color: #F8F8F8; | ||
| background-color: #141414; | ||
| margin: 0; | ||
| padding: 1%; | ||
| } | ||
| } |
There was a problem hiding this comment.
This heading theme is controlled only via prefers-color-scheme, so colorMode="dark" won’t work when the system theme is light (and colorMode="light" won’t work when the system theme is dark). If DiagramEditor is meant to allow overriding the system theme, tie these rules to a class/data-attribute set from the resolved colorMode, and use prefers-color-scheme only for the system case.
| test("Renders react flow Diagram component", async () => { | ||
| const locale = "en"; | ||
| const isReadOnly = true; | ||
|
|
||
| render(<DiagramEditor content={BASIC_VALID_WORKFLOW_YAML} locale={locale} isReadOnly={isReadOnly} />); | ||
| render( | ||
| <DiagramEditor content={BASIC_VALID_WORKFLOW_YAML} locale={locale} isReadOnly={isReadOnly} />, | ||
| ); |
There was a problem hiding this comment.
The PR introduces a new public colorMode prop, but there are no tests asserting that it’s forwarded/applied (e.g., forcing dark/light regardless of system settings). Since this is user-visible behavior, add unit coverage that renders DiagramEditor with colorMode set and verifies the expected theme signal is applied (class/data-attribute or @xyflow/react prop).
Closes Add support for dark and light theme
This feature implements dark mode by using system current status.
Screen.Recording.2026-04-15.at.2.27.00.PM.mov