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

[sailfishos][gecko] Add support for prefers-color-scheme. JB#58394 #149

Merged
merged 1 commit into from
Nov 26, 2022

Conversation

llewelld
Copy link
Member

@llewelld llewelld commented Nov 23, 2022

Adds support to qt/nsLookAndFeel for the prefers-color-scheme media tag. The renderer already supports it by setting the ui.systemUsesDarkTheme preference to 0 or 1.

This patch allows, in addition, for the colour scheme to be controlled by sending an "ambience-theme-changed" notification with a data payload of either "light" or "dark". If the ui.systemUsesDarkTheme preference is unset or set to 2, the notification value will be used to control the theme instead.

This functionality is used to update the colour scheme based on the ambience of the device.

@llewelld
Copy link
Member Author

Part of a quiver of four PRs:

  1. [sailfishos][gecko] Add support for prefers-color-scheme. JB#58394 #149
  2. [qtmozembed] Add colorMode property for prefers-color-scheme support. JB#58394 qtmozembed#47
  3. [browser] Add a "Preferred colour scheme" combobox to Settings. JB#58394 sailfish-browser#1007
  4. [webview-docs] Add docs for doNotTrack and colorScheme. JB#58394 sailfish-components-webview#161

I've added this as a separate patch, but all of the changes happen inside qt/nsLookAndFeel.cpp and qt/nsLookAndFeel.h, so this could be combined with 0002-sailfishos-qt-Bring-back-Qt-layer.-JB-50505.patch to make a single patch for both, if that's preferred.

@llewelld
Copy link
Member Author

Fixed a typo in the commit message.

Adds support to qt/nsLookAndFeel for the prefers-color-scheme media tag.
The renderer already supports it by setting the ui.systemUsesDarkTheme
preference to 0 or 1.

This patch allows, in addition, for the colour scheme to be controlled
by sending an "ambience-theme-changed" notification with a data payload
of either "light" or "dark". If the ui.systemUsesDarkTheme preference is
unset or set to 2, the notification value will be used to control the
theme instead.

This functionality is used to update the colour scheme based on the
ambience of the device.
@llewelld llewelld merged commit 7073ab4 into sailfishos:master Nov 26, 2022
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