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

[ML] Replace useIsDarkTheme() with EUI's colorMode. #205079

Merged
merged 3 commits into from
Jan 7, 2025

Conversation

walterra
Copy link
Contributor

Summary

This PR replaces the useIsDarkTheme() hook with EUI's colorMode. Since this was the last hook in @kbn/ml-kibana-theme left this removes the whole package too.

Note that the hook subscribed to an observable and was able to update the theme in place. EUI's colorMode will only be updated after a page refresh. Since updating the Kibana advanced setting to enable dark mode requires a full page refresh too, I guess it's fair to remove this behavior in favor of this simplification.

In the long run we should aim for getting rid of these checks altogether and rely on dark-mode-aware EUI tokens.

Checklist

  • Unit or functional tests were updated or added to match the most common scenarios
  • This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The release_note:breaking label should be applied in these situations.

@walterra walterra added :ml release_note:skip Skip the PR/issue when compiling release notes v9.0.0 EUI Visual Refresh labels Dec 23, 2024
@walterra walterra self-assigned this Dec 23, 2024
@walterra walterra force-pushed the ml-remove-use-is-dark-mode branch from 42fab07 to b721a55 Compare December 31, 2024 07:42
@walterra walterra force-pushed the ml-remove-use-is-dark-mode branch from 3bd352e to 3e1f0a9 Compare January 2, 2025 08:32
@walterra walterra marked this pull request as ready for review January 3, 2025 12:43
@walterra walterra requested a review from a team as a code owner January 3, 2025 12:43
@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui (:ml)

@walterra walterra requested review from rbrtj and qn895 January 3, 2025 12:44
@walterra walterra added the backport:skip This commit does not require backporting label Jan 3, 2025
Copy link
Contributor

@rbrtj rbrtj left a comment

Choose a reason for hiding this comment

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

Tested, LGTM 👍

Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

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

Code changes LGTM

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
aiops 613 610 -3
ml 2126 2124 -2
total -5

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/ml-kibana-theme 1 - -1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
aiops 613.5KB 613.3KB -225.0B
ml 4.7MB 4.7MB -249.0B
total -474.0B
Unknown metric groups

API count

id before after diff
@kbn/ml-kibana-theme 2 - -2

History

cc @walterra

@walterra walterra merged commit e8502c9 into elastic:main Jan 7, 2025
8 checks passed
@walterra walterra deleted the ml-remove-use-is-dark-mode branch January 7, 2025 16:32
kowalczyk-krzysztof pushed a commit to kowalczyk-krzysztof/kibana that referenced this pull request Jan 7, 2025
## Summary

This PR replaces the `useIsDarkTheme()` hook with EUI's `colorMode`.
Since this was the last hook in `@kbn/ml-kibana-theme` left this removes
the whole package too.

Note that the hook subscribed to an observable and was able to update
the theme in place. EUI's `colorMode` will only be updated after a page
refresh. Since updating the Kibana advanced setting to enable dark mode
requires a full page refresh too, I guess it's fair to remove this
behavior in favor of this simplification.

In the long run we should aim for getting rid of these checks altogether
and rely on dark-mode-aware EUI tokens.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
crespocarlos pushed a commit to crespocarlos/kibana that referenced this pull request Jan 8, 2025
## Summary

This PR replaces the `useIsDarkTheme()` hook with EUI's `colorMode`.
Since this was the last hook in `@kbn/ml-kibana-theme` left this removes
the whole package too.

Note that the hook subscribed to an observable and was able to update
the theme in place. EUI's `colorMode` will only be updated after a page
refresh. Since updating the Kibana advanced setting to enable dark mode
requires a full page refresh too, I guess it's fair to remove this
behavior in favor of this simplification.

In the long run we should aim for getting rid of these checks altogether
and rely on dark-mode-aware EUI tokens.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting EUI Visual Refresh :ml release_note:skip Skip the PR/issue when compiling release notes v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants