summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2023-12-04 13:36:58 +0100
committerFlorian Bruhin <me@the-compiler.org>2023-12-04 13:39:52 +0100
commit2a10461ca473838cbc3bf6b92501324470d4f521 (patch)
tree03b2345f01a8aa1b6782913b9e19ab4a9f7a8fc2
parent1cd6d5af63803f9d3fbf741dc37713e06a526b85 (diff)
downloadqutebrowser-2a10461ca473838cbc3bf6b92501324470d4f521.tar.gz
qutebrowser-2a10461ca473838cbc3bf6b92501324470d4f521.zip
Remove dark mode settings removed from Chromium
Closes #7929
-rw-r--r--doc/changelog.asciidoc6
-rw-r--r--doc/help/settings.asciidoc43
-rw-r--r--qutebrowser/browser/webengine/darkmode.py29
-rw-r--r--qutebrowser/config/configdata.yml35
-rw-r--r--tests/unit/browser/webengine/test_darkmode.py8
5 files changed, 18 insertions, 103 deletions
diff --git a/doc/changelog.asciidoc b/doc/changelog.asciidoc
index 74740de29..3bc1dbd7d 100644
--- a/doc/changelog.asciidoc
+++ b/doc/changelog.asciidoc
@@ -19,6 +19,12 @@ breaking changes (such as renamed commands) can happen in minor releases.
v3.1.0 (unreleased)
-------------------
+Removed
+~~~~~~~
+
+- The darkmode settings `grayscale.all`, `grayscale.images` and
+ `increase_text_contrast` got removed, following removals in Chromium.
+
Changed
~~~~~~~
diff --git a/doc/help/settings.asciidoc b/doc/help/settings.asciidoc
index c7744fcb7..8a39b5e68 100644
--- a/doc/help/settings.asciidoc
+++ b/doc/help/settings.asciidoc
@@ -118,9 +118,6 @@
|<<colors.webpage.darkmode.algorithm,colors.webpage.darkmode.algorithm>>|Which algorithm to use for modifying how colors are rendered with darkmode.
|<<colors.webpage.darkmode.contrast,colors.webpage.darkmode.contrast>>|Contrast for dark mode.
|<<colors.webpage.darkmode.enabled,colors.webpage.darkmode.enabled>>|Render all web contents using a dark theme.
-|<<colors.webpage.darkmode.grayscale.all,colors.webpage.darkmode.grayscale.all>>|Render all colors as grayscale.
-|<<colors.webpage.darkmode.grayscale.images,colors.webpage.darkmode.grayscale.images>>|Desaturation factor for images in dark mode.
-|<<colors.webpage.darkmode.increase_text_contrast,colors.webpage.darkmode.increase_text_contrast>>|Increase text contrast by drawing an outline of the uninverted color.
|<<colors.webpage.darkmode.policy.images,colors.webpage.darkmode.policy.images>>|Which images to apply dark mode to.
|<<colors.webpage.darkmode.policy.page,colors.webpage.darkmode.policy.page>>|Which pages to apply dark mode to.
|<<colors.webpage.darkmode.threshold.background,colors.webpage.darkmode.threshold.background>>|Threshold for inverting background elements with dark mode.
@@ -1695,46 +1692,6 @@ Type: <<types,Bool>>
Default: +pass:[false]+
-[[colors.webpage.darkmode.grayscale.all]]
-=== colors.webpage.darkmode.grayscale.all
-Render all colors as grayscale.
-This only has an effect when `colors.webpage.darkmode.algorithm` is set to `lightness-hsl` or `brightness-rgb`.
-
-This setting requires a restart.
-
-This setting is only available with the QtWebEngine backend.
-
-Type: <<types,Bool>>
-
-Default: +pass:[false]+
-
-[[colors.webpage.darkmode.grayscale.images]]
-=== colors.webpage.darkmode.grayscale.images
-Desaturation factor for images in dark mode.
-If set to 0, images are left as-is. If set to 1, images are completely grayscale. Values between 0 and 1 desaturate the colors accordingly.
-
-This setting requires a restart.
-
-This setting is only available with the QtWebEngine backend.
-
-Type: <<types,Float>>
-
-Default: +pass:[0.0]+
-
-[[colors.webpage.darkmode.increase_text_contrast]]
-=== colors.webpage.darkmode.increase_text_contrast
-Increase text contrast by drawing an outline of the uninverted color.
-
-This setting requires a restart.
-
-On QtWebEngine, this setting requires Qt 6.3 or newer.
-
-On QtWebKit, this setting is unavailable.
-
-Type: <<types,Bool>>
-
-Default: +pass:[false]+
-
[[colors.webpage.darkmode.policy.images]]
=== colors.webpage.darkmode.policy.images
Which images to apply dark mode to.
diff --git a/qutebrowser/browser/webengine/darkmode.py b/qutebrowser/browser/webengine/darkmode.py
index 0a8e0a010..e332e5c06 100644
--- a/qutebrowser/browser/webengine/darkmode.py
+++ b/qutebrowser/browser/webengine/darkmode.py
@@ -85,7 +85,8 @@ Qt 6.3
------
- New IncreaseTextContrast:
-https://chromium-review.googlesource.com/c/chromium/src/+/2893236
+ https://chromium-review.googlesource.com/c/chromium/src/+/2893236
+ (UNSUPPORTED because dropped in 6.5)
Qt 6.4
------
@@ -97,6 +98,15 @@ Qt 6.4
"Rename text_classifier to foreground_classifier"
https://chromium-review.googlesource.com/c/chromium/src/+/3226389
+
+- Grayscale darkmode support removed:
+ https://chromium-review.googlesource.com/c/chromium/src/+/3238985
+
+Qt 6.5
+------
+
+- IncreaseTextContrast removed:
+ https://chromium-review.googlesource.com/c/chromium/src/+/3821841
"""
import os
@@ -120,7 +130,6 @@ class Variant(enum.Enum):
qt_515_2 = enum.auto()
qt_515_3 = enum.auto()
- qt_63 = enum.auto()
qt_64 = enum.auto()
@@ -273,12 +282,10 @@ _DEFINITIONS: MutableMapping[Variant, _Definition] = {
_Setting('policy.images', 'ImagePolicy', _IMAGE_POLICIES),
_Setting('contrast', 'Contrast'),
- _Setting('grayscale.all', 'Grayscale', _BOOLS),
_Setting('policy.page', 'PagePolicy', _PAGE_POLICIES),
_Setting('threshold.foreground', 'TextBrightnessThreshold'),
_Setting('threshold.background', 'BackgroundBrightnessThreshold'),
- _Setting('grayscale.images', 'ImageGrayscale'),
mandatory={'enabled', 'policy.images'},
prefix='forceDarkMode',
@@ -291,21 +298,16 @@ _DEFINITIONS: MutableMapping[Variant, _Definition] = {
_Setting('policy.images', 'ImagePolicy', _IMAGE_POLICIES),
_Setting('contrast', 'ContrastPercent'),
- _Setting('grayscale.all', 'IsGrayScale', _BOOLS),
_Setting('threshold.foreground', 'TextBrightnessThreshold'),
_Setting('threshold.background', 'BackgroundBrightnessThreshold'),
- _Setting('grayscale.images', 'ImageGrayScalePercent'),
mandatory={'enabled', 'policy.images'},
prefix='',
switch_names={'enabled': _BLINK_SETTINGS, None: 'dark-mode-settings'},
),
}
-_DEFINITIONS[Variant.qt_63] = _DEFINITIONS[Variant.qt_515_3].copy_add_setting(
- _Setting('increase_text_contrast', 'IncreaseTextContrast', _INT_BOOLS),
-)
-_DEFINITIONS[Variant.qt_64] = _DEFINITIONS[Variant.qt_63].copy_replace_setting(
+_DEFINITIONS[Variant.qt_64] = _DEFINITIONS[Variant.qt_515_3].copy_replace_setting(
'threshold.foreground', 'ForegroundBrightnessThreshold',
)
@@ -328,11 +330,6 @@ _PREFERRED_COLOR_SCHEME_DEFINITIONS: Mapping[Variant, Mapping[_SettingValType, s
"light": "1",
},
- Variant.qt_63: {
- "dark": "0",
- "light": "1",
- },
-
Variant.qt_64: {
"dark": "0",
"light": "1",
@@ -351,8 +348,6 @@ def _variant(versions: version.WebEngineVersions) -> Variant:
if versions.webengine >= utils.VersionNumber(6, 4):
return Variant.qt_64
- elif versions.webengine >= utils.VersionNumber(6, 3):
- return Variant.qt_63
elif (versions.webengine == utils.VersionNumber(5, 15, 2) and
versions.chromium_major == 87):
# WORKAROUND for Gentoo packaging something newer as 5.15.2...
diff --git a/qutebrowser/config/configdata.yml b/qutebrowser/config/configdata.yml
index b49316428..51c68816b 100644
--- a/qutebrowser/config/configdata.yml
+++ b/qutebrowser/config/configdata.yml
@@ -3359,41 +3359,6 @@ colors.webpage.darkmode.threshold.background:
restart: true
backend: QtWebEngine
-colors.webpage.darkmode.grayscale.all:
- default: false
- type: Bool
- desc: >-
- Render all colors as grayscale.
-
- This only has an effect when `colors.webpage.darkmode.algorithm` is set to
- `lightness-hsl` or `brightness-rgb`.
- restart: true
- backend: QtWebEngine
-
-colors.webpage.darkmode.grayscale.images:
- default: 0.0
- type:
- name: Float
- minval: 0.0
- maxval: 1.0
- desc: >-
- Desaturation factor for images in dark mode.
-
- If set to 0, images are left as-is. If set to 1, images are completely
- grayscale. Values between 0 and 1 desaturate the colors accordingly.
- restart: true
- backend: QtWebEngine
-
-colors.webpage.darkmode.increase_text_contrast:
- default: false
- type: Bool
- desc: >-
- Increase text contrast by drawing an outline of the uninverted color.
- restart: true
- backend:
- QtWebEngine: Qt 6.3
- QtWebKit: false
-
# emacs: '
## fonts
diff --git a/tests/unit/browser/webengine/test_darkmode.py b/tests/unit/browser/webengine/test_darkmode.py
index d2f9742f1..d6b0b2432 100644
--- a/tests/unit/browser/webengine/test_darkmode.py
+++ b/tests/unit/browser/webengine/test_darkmode.py
@@ -103,7 +103,6 @@ QT_515_2_SETTINGS = {'blink-settings': [
('forceDarkModeEnabled', 'true'),
('forceDarkModeInversionAlgorithm', '2'),
('forceDarkModeImagePolicy', '2'),
- ('forceDarkModeGrayscale', 'true'),
('forceDarkModeTextBrightnessThreshold', '100'),
]}
@@ -113,7 +112,6 @@ QT_515_3_SETTINGS = {
'dark-mode-settings': [
('InversionAlgorithm', '1'),
('ImagePolicy', '2'),
- ('IsGrayScale', 'true'),
('TextBrightnessThreshold', '100'),
],
}
@@ -123,7 +121,6 @@ QT_64_SETTINGS = {
'dark-mode-settings': [
('InversionAlgorithm', '1'),
('ImagePolicy', '2'),
- ('IsGrayScale', 'true'),
('ForegroundBrightnessThreshold', '100'),
],
}
@@ -138,7 +135,6 @@ def test_qt_version_differences(config_stub, qversion, expected):
settings = {
'enabled': True,
'algorithm': 'brightness-rgb',
- 'grayscale.all': True,
'threshold.foreground': 100,
}
for k, v in settings.items():
@@ -160,10 +156,6 @@ def test_qt_version_differences(config_stub, qversion, expected):
'TextBrightnessThreshold', '100'),
('threshold.background', 100,
'BackgroundBrightnessThreshold', '100'),
- ('grayscale.all', True,
- 'Grayscale', 'true'),
- ('grayscale.images', 0.5,
- 'ImageGrayscale', '0.5'),
])
def test_customization(config_stub, setting, value, exp_key, exp_val):
config_stub.val.colors.webpage.darkmode.enabled = True