Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(UI): Add support for dark mode #2118

Merged
merged 8 commits into from
Apr 14, 2025
Merged

Conversation

lordrip
Copy link
Member

@lordrip lordrip commented Mar 25, 2025

Context

This PR adds support for selecting light and dark modes in Kaoto. The mechanism works in 3 ways:

  • Auto: It will try to read the preference from the system
  • Light: Light mode
  • Dark: Dark mode

Screenshot

Normal

Normal

Selected

Selected

Source Code editor

Source Code editor

VS Code

VSCode

Todo

  • Propagate VS Code light / dark mode setting
  • Add tests for the DOM manipulation part
  • Find a better color scheme for the group title bar in dark mode

fix: #1543

@lordrip lordrip force-pushed the feat/dark-mode branch 2 times, most recently from 45dd9b5 to 32c699d Compare March 25, 2025 23:18
Copy link

codecov bot commented Mar 25, 2025

Codecov Report

Attention: Patch coverage is 85.71429% with 4 lines in your changes missing coverage. Please review.

Project coverage is 81.50%. Comparing base (70bcb36) to head (7130325).
Report is 13 commits behind head on main.

Files with missing lines Patch % Lines
packages/ui/src/App.tsx 0.00% 3 Missing ⚠️
...ckages/ui/src/components/SourceCode/SourceCode.tsx 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               main    #2118   +/-   ##
=========================================
  Coverage     81.50%   81.50%           
  Complexity      456      456           
=========================================
  Files           522      523    +1     
  Lines         16716    16744   +28     
  Branches       3457     3492   +35     
=========================================
+ Hits          13624    13648   +24     
- Misses         2834     2838    +4     
  Partials        258      258           

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

@lordrip lordrip requested a review from a team March 30, 2025 22:08
@lordrip lordrip marked this pull request as ready for review March 30, 2025 22:08
@apupier
Copy link
Member

apupier commented Mar 31, 2025

current test failure:

 [@kaoto/kaoto]: FAIL src/multiplying-architecture/KaotoEditorApp.test.tsx
[@kaoto/kaoto]:   ● KaotoEditorApp › setTheme
[@kaoto/kaoto]: 
[@kaoto/kaoto]:     expect(jest.fn()).toHaveBeenCalledWith(...expected)
[@kaoto/kaoto]: 
[@kaoto/kaoto]:     Expected: 0
[@kaoto/kaoto]: 
[@kaoto/kaoto]:     Number of calls: 0
[@kaoto/kaoto]: 
[@kaoto/kaoto]:       173 |     await kaotoEditorApp.setTheme(EditorTheme.DARK);
[@kaoto/kaoto]:       174 |
[@kaoto/kaoto]:     > 175 |     expect(editorRef.current!.setTheme).toHaveBeenCalledWith(EditorTheme.DARK);
[@kaoto/kaoto]:           |                                         ^
[@kaoto/kaoto]:       176 |   });
[@kaoto/kaoto]:       177 |
[@kaoto/kaoto]:       178 |   it('sendReady', () => {
[@kaoto/kaoto]: 
[@kaoto/kaoto]:       at Object.toHaveBeenCalledWith (src/multiplying-architecture/KaotoEditorApp.test.tsx:175:41)

Copy link
Member

@apupier apupier left a comment

Choose a reason for hiding this comment

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

some text is written black on dark grey which is unreadable:
image
image
image

@apupier
Copy link
Member

apupier commented Mar 31, 2025

with Dark High Contrast theme in VS code, it stays light:
image

@apupier
Copy link
Member

apupier commented Apr 2, 2025

The datamapper icon on the tab might require a specific version in dark mode as it is hard to read it

image

@lordrip lordrip requested a review from apupier April 3, 2025 10:31
@lordrip lordrip marked this pull request as ready for review April 3, 2025 10:31
@lordrip lordrip requested a review from a team April 3, 2025 10:31

function App() {
const ReloadProvider = useReload();
const controller = useMemo(() => ControllerService.createController(), []);
const settingsAdapter = new LocalStorageSettingsAdapter();
let catalogUrl = CatalogSchemaLoader.DEFAULT_CATALOG_PATH;
const settingsCatalogUrl = settingsAdapter.getSettings().catalogUrl;
const colorSchema = settingsAdapter.getSettings().colorScheme;
Copy link
Contributor

Choose a reason for hiding this comment

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

(nit picking) typo, schema > schem"e"

@apupier
Copy link
Member

apupier commented Apr 3, 2025

The datamapper icon on the tab might require a specific version in dark mode as it is hard to read it

image

I do not see a difference now despite eb1e19c :
image

@lordrip
Copy link
Member Author

lordrip commented Apr 3, 2025

@apupier this is running locally
image

@apupier
Copy link
Member

apupier commented Apr 7, 2025

@apupier this is running locally image

retried and I have that now, I guess I have not recompiled correctly previously

@lordrip lordrip merged commit 8431979 into KaotoIO:main Apr 14, 2025
13 checks passed
@lordrip lordrip deleted the feat/dark-mode branch April 14, 2025 12:57
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.

Dark mode in Kaoto UI
3 participants