Skip to content

Feat:Improved dark theme implementation#4284

Open
Nguyen-Bang wants to merge 1 commit intoapache:devfrom
Nguyen-Bang:dark-theme
Open

Feat:Improved dark theme implementation#4284
Nguyen-Bang wants to merge 1 commit intoapache:devfrom
Nguyen-Bang:dark-theme

Conversation

@Nguyen-Bang
Copy link
Contributor

@Nguyen-Bang Nguyen-Bang commented Mar 23, 2026

Functionality changes:
-removed "save color schema" button in profile for more intuitive handling
-all chart types (table, pie, heatmap etc.) have default color on initialization (before it was on custom) to produce better visualization

Appearance change to mostly match Angular Material 3 standard (removed the use of manual light-dark() implementation):
-changed background to dark grey (before black) for better contrast
-removed any hardcoded colors that don't respect theme switching
-exception: hard coded color of the menu-group-title (words "Analytics", "Visualization", "Management"), since they are on a green background and difficult to read with the default color schema

The first and last 3 pictures are the before, all others are the after
Screenshot from 2026-03-23 18-42-45
Screenshot from 2026-03-23 18-42-16
Screenshot from 2026-03-23 18-42-02
Screenshot from 2026-03-23 18-41-16
Screenshot from 2026-03-23 18-41-06
Screenshot from 2026-03-23 18-27-52
Screenshot from 2026-03-23 16-58-51
Screenshot from 2026-03-23 16-58-41
Screenshot from 2026-03-23 16-58-04

Copilot AI review requested due to automatic review settings March 23, 2026 18:15
Copy link

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

This PR improves the app’s dark theme behavior and aligns more UI colors with theme-controlled CSS variables (closer to Angular Material 3 defaults), while also adjusting how appearance settings are applied and how new charts initialize their default colors.

Changes:

  • Refactors Material theme overrides and dark-mode surface/background tokens in sp-theme.scss.
  • Removes hardcoded light colors across multiple SCSS files in favor of var(--color-...) tokens.
  • Updates appearance handling (profile + app shell) and sets chart default background/text colors to theme variables.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
ui/src/scss/sp/sp-theme.scss Reworks Material theme overrides and defines explicit light/dark surface/background tokens.
ui/src/scss/sp/main.scss Replaces several hardcoded colors with theme variables for better mode switching.
ui/src/app/profile/components/general/general-profile-settings.component.ts Auto-persists appearance mode on toggle (no “save” step).
ui/src/app/profile/components/general/general-profile-settings.component.html Removes “Save color schema” button from appearance section.
ui/src/app/editor/components/pipeline-element-icon-stand/pipeline-element-icon-stand-row/pipeline-element-icon-stand-row.component.scss Removes hardcoded white background for draggable icon.
ui/src/app/core/components/toolbar/toolbar.component.ts Applies dark/light mode class to html/body/overlay container.
ui/src/app/core/components/streampipes/streampipes.component.ts Applies dark/light mode class based on darkMode$ subscription.
ui/src/app/core/components/iconbar/iconbar.component.scss Adds dark-mode-specific hardcoded text/icon color for menu group headers/chevrons.
ui/src/app/core-ui/static-properties/static-mapping-unary/static-mapping-unary.component.scss Uses theme background variable for select panels.
ui/src/app/connect/components/filter-toolbar/filter-toolbar.component.scss Uses theme background variable for select panels.
ui/src/app/chart/components/chart-view/chart-view.component.ts Initializes new widgets with theme-based background/text colors.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 147 to +159
modifyAppearance(darkMode: boolean) {
if (darkMode) {
this.overlay.getContainerElement().classList.remove('light-mode');
this.overlay.getContainerElement().classList.add('dark-mode');
} else {
this.overlay.getContainerElement().classList.remove('dark-mode');
this.overlay.getContainerElement().classList.add('light-mode');
}
const targets = [
document.documentElement,
document.body,
this.overlay.getContainerElement(),
];
const [addClass, removeClass] = darkMode
? ['dark-mode', 'light-mode']
: ['light-mode', 'dark-mode'];
targets.forEach(el => {
el.classList.remove(removeClass);
el.classList.add(addClass);
});
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

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

modifyAppearance now updates html/body/overlay classes, but it is only called from within this component. If currentUserService.darkMode$ is changed elsewhere (e.g., profile appearance setting), modifyAppearance won’t run and body/overlay can remain in the previous mode while StreampipesComponent updates only the <html> class. Suggest subscribing to darkMode$ here (and keeping the form control in sync without re-emitting) or moving this DOM class toggling into a single shared service so all entry points apply the theme consistently.

Copilot uses AI. Check for mistakes.
Comment on lines 111 to 114
changeModePreview(value: boolean) {
this.currentUserService.darkMode$.next(value);
this.updateAppearanceMode();
}
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

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

changeModePreview now persists the appearance change immediately. Two concrete issues with the current implementation: (1) external users are shown a banner that their settings can’t be changed, but this method will still issue the update request when they toggle; consider guarding against isExternalUser (or disabling the radio group) to avoid predictable failing requests, and (2) because this is now triggered on every toggle, add error handling (and possibly revert darkMode$ on failure) to avoid silently leaving the UI in a state that wasn’t saved server-side.

Copilot uses AI. Check for mistakes.
Comment on lines +65 to +74
this.darkMode$ = this.currentUserService.darkMode$.subscribe(dm => {
this.darkMode = dm;
if (dm) {
document.documentElement.classList.add('dark-mode');
document.documentElement.classList.remove('light-mode');
} else {
document.documentElement.classList.remove('dark-mode');
document.documentElement.classList.add('light-mode');
}
});
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

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

Theme class updates here only touch document.documentElement. Since ToolbarComponent.modifyAppearance also adds dark-mode/light-mode to document.body and the CDK overlay container, toggling darkMode$ outside the toolbar (e.g., from the profile appearance setting) can leave body/overlay with the previous mode, causing dialogs/overlays (and any CSS variables bound to .dark-mode/.light-mode) to render with the wrong theme. Consider centralizing theme application in a shared service, or update the same targets (html/body/overlay container) from this subscription and remove/keep the other logic accordingly so they cannot get out of sync.

Copilot uses AI. Check for mistakes.
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.

2 participants