From d2362d3aa05c8e3311197f63ef47ee95ff7c6f28 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 30 Dec 2019 17:56:15 +0100 Subject: Add more colors.contextmenu settings --- doc/changelog.asciidoc | 6 ++++-- doc/help/settings.asciidoc | 32 ++++++++++++++++++++++++++------ qutebrowser/config/configdata.yml | 28 +++++++++++++++++++++++++++- qutebrowser/mainwindow/mainwindow.py | 17 +++++++++++++---- 4 files changed, 70 insertions(+), 13 deletions(-) diff --git a/doc/changelog.asciidoc b/doc/changelog.asciidoc index 9f7a22ac2..cc44bffd7 100644 --- a/doc/changelog.asciidoc +++ b/doc/changelog.asciidoc @@ -26,8 +26,10 @@ Added tabs. - New settings to configure the appearance of context menus: - `fonts.contextmenu` - - `colors.contextmenu.bg` - - `colors.contextmenu.fg` + - `colors.contextmenu.menu.bg` + - `colors.contextmenu.menu.fg` + - `colors.contextmenu.active.bg` + - `colors.contextmenu.active.fg` - New `content.site_specific_quirks` setting which enables workarounds for websites with broken user agent parsing (enabled by default, see the "Fixed" section for fixed websites). diff --git a/doc/help/settings.asciidoc b/doc/help/settings.asciidoc index 3f43495c3..7cab1dbe9 100644 --- a/doc/help/settings.asciidoc +++ b/doc/help/settings.asciidoc @@ -32,8 +32,10 @@ |<>|Background color of the completion widget for odd rows. |<>|Color of the scrollbar in the completion view. |<>|Color of the scrollbar handle in the completion view. -|<>|Background color of the context menu. -|<>|Foreground color of the context menu. +|<>|Background color of the context menu. +|<>|Foreground color of the context menu. +|<>|Background color of the context menu's selected item. +|<>|Foreground color of the context menu's selected item. |<>|Background color for the download bar. |<>|Background color for downloads with errors. |<>|Foreground color for downloads with errors. @@ -860,8 +862,8 @@ Type: <> Default: +pass:[white]+ -[[colors.contextmenu.bg]] -=== colors.contextmenu.bg +[[colors.contextmenu.menu.bg]] +=== colors.contextmenu.menu.bg Background color of the context menu. If set to null, the Qt default is used. @@ -869,8 +871,8 @@ Type: <> Default: empty -[[colors.contextmenu.fg]] -=== colors.contextmenu.fg +[[colors.contextmenu.menu.fg]] +=== colors.contextmenu.menu.fg Foreground color of the context menu. If set to null, the Qt default is used. @@ -878,6 +880,24 @@ Type: <> Default: empty +[[colors.contextmenu.selected.bg]] +=== colors.contextmenu.selected.bg +Background color of the context menu's selected item. +If set to null, the Qt default is used. + +Type: <> + +Default: empty + +[[colors.contextmenu.selected.fg]] +=== colors.contextmenu.selected.fg +Foreground color of the context menu's selected item. +If set to null, the Qt default is used. + +Type: <> + +Default: empty + [[colors.downloads.bar.bg]] === colors.downloads.bar.bg Background color for the download bar. diff --git a/qutebrowser/config/configdata.yml b/qutebrowser/config/configdata.yml index 8d157d442..1814c3a5a 100644 --- a/qutebrowser/config/configdata.yml +++ b/qutebrowser/config/configdata.yml @@ -2084,6 +2084,12 @@ colors.completion.scrollbar.bg: desc: Color of the scrollbar in the completion view. colors.contextmenu.bg: + renamed: colors.contextmenu.menu.bg + +colors.contextmenu.fg: + renamed: colors.contextmenu.menu.fg + +colors.contextmenu.menu.bg: type: name: QssColor none_ok: true @@ -2093,7 +2099,7 @@ colors.contextmenu.bg: If set to null, the Qt default is used. -colors.contextmenu.fg: +colors.contextmenu.menu.fg: type: name: QssColor none_ok: true @@ -2103,6 +2109,26 @@ colors.contextmenu.fg: If set to null, the Qt default is used. +colors.contextmenu.selected.bg: + type: + name: QssColor + none_ok: true + default: null + desc: >- + Background color of the context menu's selected item. + + If set to null, the Qt default is used. + +colors.contextmenu.selected.fg: + type: + name: QssColor + none_ok: true + default: null + desc: >- + Foreground color of the context menu's selected item. + + If set to null, the Qt default is used. + colors.downloads.bar.bg: default: black type: QssColor diff --git a/qutebrowser/mainwindow/mainwindow.py b/qutebrowser/mainwindow/mainwindow.py index e0f047bfb..c2dea4dc7 100644 --- a/qutebrowser/mainwindow/mainwindow.py +++ b/qutebrowser/mainwindow/mainwindow.py @@ -165,11 +165,20 @@ class MainWindow(QWidget): {% if conf.fonts.contextmenu %} font: {{ conf.fonts.contextmenu }}; {% endif %} - {% if conf.colors.contextmenu.bg %} - background-color: {{ conf.colors.contextmenu.bg }}; + {% if conf.colors.contextmenu.menu.bg %} + background-color: {{ conf.colors.contextmenu.menu.bg }}; {% endif %} - {% if conf.colors.contextmenu.fg %} - color: {{ conf.colors.contextmenu.fg }}; + {% if conf.colors.contextmenu.menu.fg %} + color: {{ conf.colors.contextmenu.menu.fg }}; + {% endif %} + } + + QMenu::item:selected { + {% if conf.colors.contextmenu.selected.bg %} + background-color: {{ conf.colors.contextmenu.selected.bg }}; + {% endif %} + {% if conf.colors.contextmenu.selected.fg %} + color: {{ conf.colors.contextmenu.selected.fg }}; {% endif %} } """ -- cgit v1.2.3-54-g00ecf