Skip to content

System default dark mode#92

Open
kumaradityaraj wants to merge 9 commits intoserverlessworkflow:mainfrom
kumaradityaraj:darkMode
Open

System default dark mode#92
kumaradityaraj wants to merge 9 commits intoserverlessworkflow:mainfrom
kumaradityaraj:darkMode

Conversation

@kumaradityaraj
Copy link
Copy Markdown
Contributor

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

Signed-off-by: kumaradityaraj <sedulous.0007@gmail.com>
Copilot AI review requested due to automatic review settings April 15, 2026 08:59
@kumaradityaraj kumaradityaraj requested review from fantonangeli, handreyrc and lornakelly and removed request for Copilot and handreyrc April 15, 2026 09:02
@lornakelly
Copy link
Copy Markdown
Contributor

lornakelly commented Apr 15, 2026

@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"

Comment thread packages/serverless-workflow-diagram-editor/src/react-flow/diagram/Diagram.tsx Outdated
Signed-off-by: kumaradityaraj <sedulous.0007@gmail.com>
Copilot AI review requested due to automatic review settings April 15, 2026 13:04
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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/react ReactFlow via component state.
  • Add a UI <select> to manually switch between dark, light, and system.
  • Remove .diagram-background styling 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.

Comment thread packages/serverless-workflow-diagram-editor/src/react-flow/diagram/Diagram.tsx Outdated
Comment thread packages/serverless-workflow-diagram-editor/src/react-flow/diagram/Diagram.tsx Outdated
Comment thread packages/serverless-workflow-diagram-editor/src/react-flow/diagram/Diagram.tsx Outdated
Comment thread packages/serverless-workflow-diagram-editor/src/react-flow/diagram/Diagram.tsx Outdated
Comment thread packages/serverless-workflow-diagram-editor/test-results/.last-run.json Outdated
@kumaradityaraj
Copy link
Copy Markdown
Contributor Author

@fantonangeli implement an attribute in the component to override this behaviour and force a specific theme by this you mean adding a side button for selecting modes or is it something copilot is suggesting here

@fantonangeli
Copy link
Copy Markdown
Member

@kumaradityaraj I was thinking about:

  • adding a property here:
    packages/serverless-workflow-diagram-editor/src/diagram-editor/DiagramEditor.tsx:29
  • received from:
    packages/serverless-workflow-diagram-editor/stories/DiagramEditor.tsx:26
  • and finally passing it to Reactflow like you already did here:
    packages/serverless-workflow-diagram-editor/src/react-flow/diagram/Diagram.tsx:96

Comment thread packages/serverless-workflow-diagram-editor/src/react-flow/diagram/Diagram.tsx Outdated
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.

leftover?

Signed-off-by: kumaradityaraj <sedulous.0007@gmail.com>
Signed-off-by: kumaradityaraj <sedulous.0007@gmail.com>
Copilot AI review requested due to automatic review settings April 21, 2026 07:26
Signed-off-by: kumaradityaraj <sedulous.0007@gmail.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Comment thread packages/serverless-workflow-diagram-editor/src/react-flow/diagram/Diagram.tsx Outdated
Comment thread packages/serverless-workflow-diagram-editor/src/diagram-editor/DiagramEditor.tsx Outdated
kumaradityaraj and others added 3 commits April 21, 2026 13:12
Signed-off-by: kumaradityaraj <sedulous.0007@gmail.com>
Signed-off-by: fantonangeli <fabrizio.antonangeli@gmail.com>
Copilot AI review requested due to automatic review settings April 21, 2026 09:56
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Comment on lines +27 to +32
@media (prefers-color-scheme: dark) {
.diagram-background{
--xy-background-pattern-color: inherit;
background-color: inherit;
}
}
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

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

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").

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@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?

Comment on lines +17 to +31
.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%;
}
}
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Comment on lines 27 to +33
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} />,
);
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

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

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).

Copilot uses AI. Check for mistakes.
Comment thread packages/serverless-workflow-diagram-editor/src/types/colorMode.ts
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.

Add support for dark and light theme

4 participants