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

Dark mode cannot be activated on Android devices #796

Open
vincent10400094 opened this issue Jul 23, 2021 · 0 comments
Open

Dark mode cannot be activated on Android devices #796

vincent10400094 opened this issue Jul 23, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@vincent10400094
Copy link
Contributor

vincent10400094 commented Jul 23, 2021

Description

The current dark mode implementation uses media queries to detect whether the system theme is light or dark . For example:

@media (prefers-color-scheme: dark) {
  /* css for dark theme */
}

@media (prefers-color-scheme: light) {
  /* css for light theme */
}

However, current Android WebView doesn't support prefers-color-scheme query (see Browser compatibility), which leads to the following problems:

  1. Dark mode cannot be activated successfully
  2. Some css selectors only deals with dark and light theme, but not deals with no-preference. which may cause unintended appearance (as the screenshots shown in Logs)

Steps to Reproduce

  1. Build the app
  2. Enable dark mode in Android device
  3. Open the Capture app in Android device

Expected Behavior

  • Expected: Dark mode can be activated and all elements should look as intended
  • Actual: Dark mode cannot be activated and some elements do not look as intended

Logs

combine!UNITO-UNDERSCORE!images-2

Environment

  • Version: Feature dark mode #786
  • OS: Android 10
  • Device: Pixel 3a

Possible Solutions

  1. For some elements not rendered properly, handle the case besides light and dark may solve it
@media (prefers-color-scheme: dark) {
  /* css for dark theme */
}

@media (prefers-color-scheme: light) {
  /* css for light theme */
}

@media (prefers-color-scheme: no-preference) {
  /* css for android */
}
  1. For detecting system's theme preference and forcing dark theme. This workaround works for SDK >= 29

┆Issue is synchronized with this Asana task by Unito

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant