From 69f729dbe5156330c4a866a78be6003ecb12c4d5 Mon Sep 17 00:00:00 2001 From: Austin Anderson Date: Sat, 9 May 2015 18:07:40 -0400 Subject: [PATCH 01/16] Added foreground color settings for statusbar messages. --- qutebrowser/config/configdata.py | 16 ++++++++++++++++ qutebrowser/mainwindow/statusbar/bar.py | 21 +++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index e0e613892..d5ec8e9bd 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -804,18 +804,34 @@ def data(readonly=False): SettingValue(typ.QssColor(), 'red'), "Background color of the statusbar if there was an error."), + ('statusbar.fg.error', + SettingValue(typ.QssColor(), 'white'), + "Foreground color of the statusbar if there was an error."), + ('statusbar.bg.warning', SettingValue(typ.QssColor(), 'darkorange'), "Background color of the statusbar if there is a warning."), + ('statusbar.fg.warning', + SettingValue(typ.QssColor(), 'white'), + "Foreground color of the statusbar if there is a warning."), + ('statusbar.bg.prompt', SettingValue(typ.QssColor(), 'darkblue'), "Background color of the statusbar if there is a prompt."), + ('statusbar.fg.prompt', + SettingValue(typ.QssColor(), 'white'), + "Foreground color of the statusbar if there is a prompt."), + ('statusbar.bg.insert', SettingValue(typ.QssColor(), 'darkgreen'), "Background color of the statusbar in insert mode."), + ('statusbar.fg.insert', + SettingValue(typ.QssColor(), 'white'), + "Foreground color of the statusbar in insert mode."), + ('statusbar.progress.bg', SettingValue(typ.QssColor(), 'white'), "Background color of the progress bar."), diff --git a/qutebrowser/mainwindow/statusbar/bar.py b/qutebrowser/mainwindow/statusbar/bar.py index a1c8aabd0..2a034223b 100644 --- a/qutebrowser/mainwindow/statusbar/bar.py +++ b/qutebrowser/mainwindow/statusbar/bar.py @@ -97,26 +97,47 @@ class StatusBar(QWidget): {{ color['statusbar.bg'] }} } + QWidget#StatusBar QLabel { + {{ color['statusbar.fg'] }} + } + QWidget#StatusBar[insert_active="true"] { {{ color['statusbar.bg.insert'] }} } + QWidget#StatusBar[insert_active="true"] QLabel { + {{ color['statusbar.fg.insert'] }} + } + QWidget#StatusBar[prompt_active="true"] { {{ color['statusbar.bg.prompt'] }} } + QWidget#StatusBar[prompt_active="true"] QLabel { + {{ color['statusbar.fg.prompt'] }} + } + QWidget#StatusBar[severity="error"] { {{ color['statusbar.bg.error'] }} } + QWidget#StatusBar[severity="error"] QLabel { + {{ color['statusbar.fg.error'] }} + } + QWidget#StatusBar[severity="warning"] { {{ color['statusbar.bg.warning'] }} } + QWidget#StatusBar[severity="warning"] QLabel { + {{ color['statusbar.fg.warning'] }} + } + QLabel, QLineEdit { {{ color['statusbar.fg'] }} {{ font['statusbar'] }} } + """ def __init__(self, win_id, parent=None): From 244d2753df3fd63af468e49d31d591e4a6a16342 Mon Sep 17 00:00:00 2001 From: Austin Anderson Date: Sun, 10 May 2015 15:33:58 -0400 Subject: [PATCH 02/16] Reordered fg/bg statusbar color options Options are now all fg, bg for each variant. --- qutebrowser/config/configdata.py | 56 ++++++++++++++++---------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index d5ec8e9bd..98787c284 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -792,46 +792,46 @@ def data(readonly=False): SettingValue(typ.QssColor(), '#ff4444'), "Foreground color of the matched text in the completion."), - ('statusbar.bg', - SettingValue(typ.QssColor(), 'black'), - "Foreground color of the statusbar."), - ('statusbar.fg', SettingValue(typ.QssColor(), 'white'), "Foreground color of the statusbar."), - ('statusbar.bg.error', - SettingValue(typ.QssColor(), 'red'), - "Background color of the statusbar if there was an error."), + ('statusbar.bg', + SettingValue(typ.QssColor(), 'black'), + "Foreground color of the statusbar."), ('statusbar.fg.error', SettingValue(typ.QssColor(), 'white'), "Foreground color of the statusbar if there was an error."), - ('statusbar.bg.warning', - SettingValue(typ.QssColor(), 'darkorange'), - "Background color of the statusbar if there is a warning."), + ('statusbar.bg.error', + SettingValue(typ.QssColor(), 'red'), + "Background color of the statusbar if there was an error."), ('statusbar.fg.warning', SettingValue(typ.QssColor(), 'white'), "Foreground color of the statusbar if there is a warning."), - ('statusbar.bg.prompt', - SettingValue(typ.QssColor(), 'darkblue'), - "Background color of the statusbar if there is a prompt."), + ('statusbar.bg.warning', + SettingValue(typ.QssColor(), 'darkorange'), + "Background color of the statusbar if there is a warning."), ('statusbar.fg.prompt', SettingValue(typ.QssColor(), 'white'), "Foreground color of the statusbar if there is a prompt."), - ('statusbar.bg.insert', - SettingValue(typ.QssColor(), 'darkgreen'), - "Background color of the statusbar in insert mode."), + ('statusbar.bg.prompt', + SettingValue(typ.QssColor(), 'darkblue'), + "Background color of the statusbar if there is a prompt."), ('statusbar.fg.insert', SettingValue(typ.QssColor(), 'white'), "Foreground color of the statusbar in insert mode."), + ('statusbar.bg.insert', + SettingValue(typ.QssColor(), 'darkgreen'), + "Background color of the statusbar in insert mode."), + ('statusbar.progress.bg', SettingValue(typ.QssColor(), 'white'), "Background color of the progress bar."), @@ -863,22 +863,22 @@ def data(readonly=False): SettingValue(typ.QtColor(), 'white'), "Foreground color of unselected odd tabs."), - ('tabs.fg.even', - SettingValue(typ.QtColor(), 'white'), - "Foreground color of unselected even tabs."), - - ('tabs.fg.selected', - SettingValue(typ.QtColor(), 'white'), - "Foreground color of selected tabs."), - ('tabs.bg.odd', SettingValue(typ.QtColor(), 'grey'), "Background color of unselected odd tabs."), + ('tabs.fg.even', + SettingValue(typ.QtColor(), 'white'), + "Foreground color of unselected even tabs."), + ('tabs.bg.even', SettingValue(typ.QtColor(), 'darkgrey'), "Background color of unselected even tabs."), + ('tabs.fg.selected', + SettingValue(typ.QtColor(), 'white'), + "Foreground color of selected tabs."), + ('tabs.bg.selected', SettingValue(typ.QtColor(), 'black'), "Background color of selected tabs."), @@ -907,10 +907,6 @@ def data(readonly=False): SettingValue(typ.CssColor(), 'black'), "Font color for hints."), - ('hints.fg.match', - SettingValue(typ.CssColor(), 'green'), - "Font color for the matched part of hints."), - ('hints.bg', SettingValue( typ.CssColor(), '-webkit-gradient(linear, left top, ' @@ -918,6 +914,10 @@ def data(readonly=False): 'color-stop(100%,#FFC542))'), "Background color for hints."), + ('hints.fg.match', + SettingValue(typ.CssColor(), 'green'), + "Font color for the matched part of hints."), + ('downloads.fg', SettingValue(typ.QtColor(), '#ffffff'), "Foreground color for downloads."), From 1a2a57d59eccee3de70899fdfac6db4c90dd1c61 Mon Sep 17 00:00:00 2001 From: Austin Anderson Date: Mon, 11 May 2015 22:27:21 -0400 Subject: [PATCH 03/16] Added command mode color configuration options. Including necessary tracker variable _command_active. --- qutebrowser/config/configdata.py | 8 ++++ qutebrowser/mainwindow/statusbar/bar.py | 49 +++++++++++++++++++++---- 2 files changed, 50 insertions(+), 7 deletions(-) diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index 98787c284..9327dd377 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -832,6 +832,14 @@ def data(readonly=False): SettingValue(typ.QssColor(), 'darkgreen'), "Background color of the statusbar in insert mode."), + ('statusbar.fg.command', + SettingValue(typ.QssColor(), '${statusbar.fg}'), + "Foreground color of the statusbar in command mode."), + + ('statusbar.bg.command', + SettingValue(typ.QssColor(), '${statusbar.bg}'), + "Background color of the statusbar in command mode."), + ('statusbar.progress.bg', SettingValue(typ.QssColor(), 'white'), "Background color of the progress bar."), diff --git a/qutebrowser/mainwindow/statusbar/bar.py b/qutebrowser/mainwindow/statusbar/bar.py index 2a034223b..98d2d05e0 100644 --- a/qutebrowser/mainwindow/statusbar/bar.py +++ b/qutebrowser/mainwindow/statusbar/bar.py @@ -77,6 +77,10 @@ class StatusBar(QWidget): For some reason we need to have this as class attribute so pyqtProperty works correctly. + _command_active: If we're currently in command mode. + + For some reason we need to have this as class attribute + so pyqtProperty works correctly. Signals: resized: Emitted when the statusbar has resized, so the completion widget can adjust its size to it. @@ -91,6 +95,7 @@ class StatusBar(QWidget): _severity = None _prompt_active = False _insert_active = False + _command_active = False STYLESHEET = """ QWidget#StatusBar { @@ -101,12 +106,8 @@ class StatusBar(QWidget): {{ color['statusbar.fg'] }} } - QWidget#StatusBar[insert_active="true"] { - {{ color['statusbar.bg.insert'] }} - } - - QWidget#StatusBar[insert_active="true"] QLabel { - {{ color['statusbar.fg.insert'] }} + QWidget#StatusBar QLineEdit { + {{ color['statusbar.fg.command'] }} } QWidget#StatusBar[prompt_active="true"] { @@ -117,6 +118,22 @@ class StatusBar(QWidget): {{ color['statusbar.fg.prompt'] }} } + QWidget#StatusBar[insert_active="true"] { + {{ color['statusbar.bg.insert'] }} + } + + QWidget#StatusBar[insert_active="true"] QLabel { + {{ color['statusbar.fg.insert'] }} + } + + QWidget#StatusBar[command_active="true"] QLabel { + {{ color['statusbar.fg.command'] }} + } + + QWidget#StatusBar[command_active="true"] { + {{ color['statusbar.bg.command'] }} + } + QWidget#StatusBar[severity="error"] { {{ color['statusbar.bg.error'] }} } @@ -134,7 +151,6 @@ class StatusBar(QWidget): } QLabel, QLineEdit { - {{ color['statusbar.fg'] }} {{ font['statusbar'] }} } @@ -269,6 +285,21 @@ class StatusBar(QWidget): self._prompt_active = val self.setStyleSheet(style.get_stylesheet(self.STYLESHEET)) + @pyqtProperty(bool) + def command_active(self): + """Getter for self.command_active, so it can be used as Qt property.""" + return self._command_active + + def _set_command_active(self, val): + """Setter for self._command_active. + + Re-set the stylesheet after setting the value, so everything gets + updated by Qt properly. + """ + log.statusbar.debug("Setting command_active to {}".format(val)) + self._command_active = val + self.setStyleSheet(style.get_stylesheet(self.STYLESHEET)) + @pyqtProperty(bool) def insert_active(self): """Getter for self.insert_active, so it can be used as Qt property.""" @@ -461,6 +492,8 @@ class StatusBar(QWidget): self._set_mode_text(mode.name) if mode == usertypes.KeyMode.insert: self._set_insert_active(True) + if mode == usertypes.KeyMode.command: + self._set_command_active(True) @pyqtSlot(usertypes.KeyMode, usertypes.KeyMode) def on_mode_left(self, old_mode, new_mode): @@ -474,6 +507,8 @@ class StatusBar(QWidget): self.txt.set_text(self.txt.Text.normal, '') if old_mode == usertypes.KeyMode.insert: self._set_insert_active(False) + if old_mode == usertypes.KeyMode.command: + self._set_command_active(False) @config.change_filter('ui', 'message-timeout') def set_pop_timer_interval(self): From 14c1332017f23a01f167b910b140d7291d2aa6dc Mon Sep 17 00:00:00 2001 From: Austin Anderson Date: Mon, 11 May 2015 22:28:12 -0400 Subject: [PATCH 04/16] Reordered statusbar stylesheet to match configuration ordering. --- qutebrowser/mainwindow/statusbar/bar.py | 32 ++++++++++++------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/qutebrowser/mainwindow/statusbar/bar.py b/qutebrowser/mainwindow/statusbar/bar.py index 98d2d05e0..53c991c86 100644 --- a/qutebrowser/mainwindow/statusbar/bar.py +++ b/qutebrowser/mainwindow/statusbar/bar.py @@ -110,6 +110,22 @@ class StatusBar(QWidget): {{ color['statusbar.fg.command'] }} } + QWidget#StatusBar[severity="error"] { + {{ color['statusbar.bg.error'] }} + } + + QWidget#StatusBar[severity="error"] QLabel { + {{ color['statusbar.fg.error'] }} + } + + QWidget#StatusBar[severity="warning"] { + {{ color['statusbar.bg.warning'] }} + } + + QWidget#StatusBar[severity="warning"] QLabel { + {{ color['statusbar.fg.warning'] }} + } + QWidget#StatusBar[prompt_active="true"] { {{ color['statusbar.bg.prompt'] }} } @@ -134,22 +150,6 @@ class StatusBar(QWidget): {{ color['statusbar.bg.command'] }} } - QWidget#StatusBar[severity="error"] { - {{ color['statusbar.bg.error'] }} - } - - QWidget#StatusBar[severity="error"] QLabel { - {{ color['statusbar.fg.error'] }} - } - - QWidget#StatusBar[severity="warning"] { - {{ color['statusbar.bg.warning'] }} - } - - QWidget#StatusBar[severity="warning"] QLabel { - {{ color['statusbar.fg.warning'] }} - } - QLabel, QLineEdit { {{ font['statusbar'] }} } From 0d66647918c4d27001752ba8ba08dd1bcd954f0d Mon Sep 17 00:00:00 2001 From: Austin Anderson Date: Mon, 11 May 2015 22:35:44 -0400 Subject: [PATCH 05/16] Set extra foreground colors to match the default by default. --- qutebrowser/config/configdata.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index 9327dd377..b4bfbd900 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -801,7 +801,7 @@ def data(readonly=False): "Foreground color of the statusbar."), ('statusbar.fg.error', - SettingValue(typ.QssColor(), 'white'), + SettingValue(typ.QssColor(), '${statusbar.fg}'), "Foreground color of the statusbar if there was an error."), ('statusbar.bg.error', @@ -809,7 +809,7 @@ def data(readonly=False): "Background color of the statusbar if there was an error."), ('statusbar.fg.warning', - SettingValue(typ.QssColor(), 'white'), + SettingValue(typ.QssColor(), '${statusbar.fg}'), "Foreground color of the statusbar if there is a warning."), ('statusbar.bg.warning', @@ -817,7 +817,7 @@ def data(readonly=False): "Background color of the statusbar if there is a warning."), ('statusbar.fg.prompt', - SettingValue(typ.QssColor(), 'white'), + SettingValue(typ.QssColor(), '${statusbar.fg}'), "Foreground color of the statusbar if there is a prompt."), ('statusbar.bg.prompt', @@ -825,7 +825,7 @@ def data(readonly=False): "Background color of the statusbar if there is a prompt."), ('statusbar.fg.insert', - SettingValue(typ.QssColor(), 'white'), + SettingValue(typ.QssColor(), '${statusbar.fg}'), "Foreground color of the statusbar in insert mode."), ('statusbar.bg.insert', From 229733f1b03079dd2c1ad6c28a7d4fe518ba97e7 Mon Sep 17 00:00:00 2001 From: Austin Anderson Date: Mon, 11 May 2015 22:46:26 -0400 Subject: [PATCH 06/16] Properly distinguish between statusbar modes when styling line input. --- qutebrowser/mainwindow/statusbar/bar.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/qutebrowser/mainwindow/statusbar/bar.py b/qutebrowser/mainwindow/statusbar/bar.py index 53c991c86..aca145f6a 100644 --- a/qutebrowser/mainwindow/statusbar/bar.py +++ b/qutebrowser/mainwindow/statusbar/bar.py @@ -107,7 +107,7 @@ class StatusBar(QWidget): } QWidget#StatusBar QLineEdit { - {{ color['statusbar.fg.command'] }} + {{ color['statusbar.fg'] }} } QWidget#StatusBar[severity="error"] { @@ -134,6 +134,10 @@ class StatusBar(QWidget): {{ color['statusbar.fg.prompt'] }} } + QWidget#StatusBar[prompt_active="true"] QLineEdit { + {{ color['statusbar.fg.prompt'] }} + } + QWidget#StatusBar[insert_active="true"] { {{ color['statusbar.bg.insert'] }} } @@ -142,12 +146,16 @@ class StatusBar(QWidget): {{ color['statusbar.fg.insert'] }} } + QWidget#StatusBar[command_active="true"] { + {{ color['statusbar.bg.command'] }} + } + QWidget#StatusBar[command_active="true"] QLabel { {{ color['statusbar.fg.command'] }} } - QWidget#StatusBar[command_active="true"] { - {{ color['statusbar.bg.command'] }} + QWidget#StatusBar[command_active="true"] QLineEdit { + {{ color['statusbar.fg.command'] }} } QLabel, QLineEdit { From 05530944944b95e324303d6e0ae02ec5e98b09d5 Mon Sep 17 00:00:00 2001 From: Austin Anderson Date: Mon, 25 May 2015 19:20:33 -0400 Subject: [PATCH 07/16] Added explanation of *.system values to settings page. --- qutebrowser/config/configdata.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index b4bfbd900..ad321b73d 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -103,6 +103,10 @@ SECTION_DESC = { " * A gradient as explained in http://qt-project.org/doc/qt-4.8/" "stylesheet-reference.html#list-of-property-types[the Qt " "documentation] under ``Gradient''.\n\n" + "A *.system value determines the color system to use for color " + "interpolation between similarly-named *.start and *.stop entries, " + "regardless of how they are defined in the options. " + "Valid values are 'rgb', 'hsv', and 'hsl'.\n\n" "The `hints.*` values are a special case as they're real CSS " "colors, not Qt-CSS colors. There, for a gradient, you need to use " "`-webkit-gradient`, see https://www.webkit.org/blog/175/introducing-" From a8d2dbfdfb44d41f7f9c17c38c5251d26379f129 Mon Sep 17 00:00:00 2001 From: Austin Anderson Date: Mon, 25 May 2015 20:47:16 -0400 Subject: [PATCH 08/16] Added downloads bar fg customization, and refactored the download's color-picking. --- qutebrowser/browser/downloads.py | 20 ++++++++++++-------- qutebrowser/config/configdata.py | 20 ++++++++++++++++---- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/qutebrowser/browser/downloads.py b/qutebrowser/browser/downloads.py index 6d12761f6..e30147e10 100644 --- a/qutebrowser/browser/downloads.py +++ b/qutebrowser/browser/downloads.py @@ -356,12 +356,16 @@ class DownloadItem(QObject): if reply.error() != QNetworkReply.NoError: QTimer.singleShot(0, lambda: self.error.emit(reply.errorString())) - def bg_color(self): - """Background color to be shown.""" - start = config.get('colors', 'downloads.bg.start') - stop = config.get('colors', 'downloads.bg.stop') - system = config.get('colors', 'downloads.bg.system') - error = config.get('colors', 'downloads.bg.error') + def get_status_color(self, position): + """Choose an appropriate color for presenting the download's status. + + Args: + position: The color type requested, can be 'fg' or 'bg'. + """ + start = config.get('colors', 'downloads.{}.start'.format(position)) + stop = config.get('colors', 'downloads.{}.stop'.format(position)) + system = config.get('colors', 'downloads.{}.system'.format(position)) + error = config.get('colors', 'downloads.{}.error'.format(position)) if self.error_msg is not None: assert not self.successful return error @@ -1020,9 +1024,9 @@ class DownloadManager(QAbstractListModel): if role == Qt.DisplayRole: data = str(item) elif role == Qt.ForegroundRole: - data = config.get('colors', 'downloads.fg') + data = item.get_status_color('fg') elif role == Qt.BackgroundRole: - data = item.bg_color() + data = item.get_status_color('bg') elif role == ModelRole.item: data = item elif role == Qt.ToolTipRole: diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index ad321b73d..db16a2bbf 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -930,26 +930,38 @@ def data(readonly=False): SettingValue(typ.CssColor(), 'green'), "Font color for the matched part of hints."), - ('downloads.fg', - SettingValue(typ.QtColor(), '#ffffff'), - "Foreground color for downloads."), - ('downloads.bg.bar', SettingValue(typ.QssColor(), 'black'), "Background color for the download bar."), + ('downloads.fg.start', + SettingValue(typ.QtColor(), '#0000aa'), + "Color gradient start for downloads."), + ('downloads.bg.start', SettingValue(typ.QtColor(), '#0000aa'), "Color gradient start for downloads."), + ('downloads.fg.stop', + SettingValue(typ.QtColor(), '#00aa00'), + "Color gradient end for downloads."), + ('downloads.bg.stop', SettingValue(typ.QtColor(), '#00aa00'), "Color gradient end for downloads."), + ('downloads.fg.system', + SettingValue(typ.ColorSystem(), 'rgb'), + "Color gradient interpolation system for downloads."), + ('downloads.bg.system', SettingValue(typ.ColorSystem(), 'rgb'), "Color gradient interpolation system for downloads."), + ('downloads.fg.error', + SettingValue(typ.QtColor(), 'red'), + "Foreground color for downloads with errors."), + ('downloads.bg.error', SettingValue(typ.QtColor(), 'red'), "Background color for downloads with errors."), From 7b5d2ace2485b91707ce03b79e76be6580c51d41 Mon Sep 17 00:00:00 2001 From: Austin Anderson Date: Sat, 30 May 2015 15:21:34 -0400 Subject: [PATCH 09/16] Added assertion for parameterized download color picker. --- qutebrowser/browser/downloads.py | 1 + 1 file changed, 1 insertion(+) diff --git a/qutebrowser/browser/downloads.py b/qutebrowser/browser/downloads.py index e30147e10..f10cd7aad 100644 --- a/qutebrowser/browser/downloads.py +++ b/qutebrowser/browser/downloads.py @@ -362,6 +362,7 @@ class DownloadItem(QObject): Args: position: The color type requested, can be 'fg' or 'bg'. """ + assert position in ("fg", "bg") start = config.get('colors', 'downloads.{}.start'.format(position)) stop = config.get('colors', 'downloads.{}.stop'.format(position)) system = config.get('colors', 'downloads.{}.system'.format(position)) From fed2cdad4ef138f44171a699d39a3eb7211b87ba Mon Sep 17 00:00:00 2001 From: Austin Anderson Date: Sat, 30 May 2015 15:22:00 -0400 Subject: [PATCH 10/16] Cleaned up download configuration options. --- qutebrowser/config/configdata.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index db16a2bbf..67f847865 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -935,31 +935,32 @@ def data(readonly=False): "Background color for the download bar."), ('downloads.fg.start', - SettingValue(typ.QtColor(), '#0000aa'), - "Color gradient start for downloads."), + SettingValue(typ.QtColor(), 'white'), + "Color gradient start for download foreground text."), ('downloads.bg.start', SettingValue(typ.QtColor(), '#0000aa'), - "Color gradient start for downloads."), + "Color gradient start for download background."), ('downloads.fg.stop', - SettingValue(typ.QtColor(), '#00aa00'), - "Color gradient end for downloads."), + SettingValue(typ.QtColor(), '${downloads.fg.start}'), + "Color gradient end for download foreground text."), ('downloads.bg.stop', SettingValue(typ.QtColor(), '#00aa00'), - "Color gradient end for downloads."), + "Color gradient stop for download background."), ('downloads.fg.system', SettingValue(typ.ColorSystem(), 'rgb'), - "Color gradient interpolation system for downloads."), + "Color gradient interpolation system for download foreground" + "text."), ('downloads.bg.system', SettingValue(typ.ColorSystem(), 'rgb'), - "Color gradient interpolation system for downloads."), + "Color gradient interpolation system for download background."), ('downloads.fg.error', - SettingValue(typ.QtColor(), 'red'), + SettingValue(typ.QtColor(), 'white'), "Foreground color for downloads with errors."), ('downloads.bg.error', From 5c599879f819e600d11bcf197f0a902a812fdde6 Mon Sep 17 00:00:00 2001 From: Austin Anderson Date: Sat, 30 May 2015 16:03:36 -0400 Subject: [PATCH 11/16] Fixed a line-length error. --- qutebrowser/mainwindow/statusbar/bar.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qutebrowser/mainwindow/statusbar/bar.py b/qutebrowser/mainwindow/statusbar/bar.py index 1e4ae3b84..9b1219b38 100644 --- a/qutebrowser/mainwindow/statusbar/bar.py +++ b/qutebrowser/mainwindow/statusbar/bar.py @@ -80,8 +80,8 @@ class StatusBar(QWidget): _command_active: If we're currently in command mode. - For some reason we need to have this as class attribute - so pyqtProperty works correctly. + For some reason we need to have this as class + attribute so pyqtProperty works correctly. _caret_mode: The current caret mode (off/on/selection). From 4d141f489f18d98e00df249a89356c87fef69361 Mon Sep 17 00:00:00 2001 From: Austin Anderson Date: Wed, 3 Jun 2015 08:42:13 -0400 Subject: [PATCH 12/16] Added pylint workaround directive to quash rebellion. --- qutebrowser/browser/downloads.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qutebrowser/browser/downloads.py b/qutebrowser/browser/downloads.py index 3a7c63fc0..22e8858af 100644 --- a/qutebrowser/browser/downloads.py +++ b/qutebrowser/browser/downloads.py @@ -362,6 +362,8 @@ class DownloadItem(QObject): Args: position: The color type requested, can be 'fg' or 'bg'. """ + # pylint: disable=bad-config-call + # WORKAROUND for https://bitbucket.org/logilab/astroid/issue/104/ assert position in ("fg", "bg") start = config.get('colors', 'downloads.{}.start'.format(position)) stop = config.get('colors', 'downloads.{}.stop'.format(position)) From ebc013ac2af4afb9aef56ee30249ff638b15e6c1 Mon Sep 17 00:00:00 2001 From: Austin Anderson Date: Thu, 4 Jun 2015 22:50:04 -0400 Subject: [PATCH 13/16] Removed redundant setter. --- qutebrowser/mainwindow/statusbar/bar.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/qutebrowser/mainwindow/statusbar/bar.py b/qutebrowser/mainwindow/statusbar/bar.py index 9b1219b38..abcc5f5f6 100644 --- a/qutebrowser/mainwindow/statusbar/bar.py +++ b/qutebrowser/mainwindow/statusbar/bar.py @@ -326,16 +326,6 @@ class StatusBar(QWidget): """Getter for self.command_active, so it can be used as Qt property.""" return self._command_active - def _set_command_active(self, val): - """Setter for self._command_active. - - Re-set the stylesheet after setting the value, so everything gets - updated by Qt properly. - """ - log.statusbar.debug("Setting command_active to {}".format(val)) - self._command_active = val - self.setStyleSheet(style.get_stylesheet(self.STYLESHEET)) - @pyqtProperty(bool) def insert_active(self): """Getter for self.insert_active, so it can be used as Qt property.""" From 34d4c0837470c8abe5ac92ede344812cc5fa3443 Mon Sep 17 00:00:00 2001 From: Austin Anderson Date: Thu, 4 Jun 2015 22:30:40 -0400 Subject: [PATCH 14/16] Significantly reduced the size of the bar stylesheet. --- qutebrowser/mainwindow/statusbar/bar.py | 80 +++++++------------------ 1 file changed, 23 insertions(+), 57 deletions(-) diff --git a/qutebrowser/mainwindow/statusbar/bar.py b/qutebrowser/mainwindow/statusbar/bar.py index abcc5f5f6..05079413b 100644 --- a/qutebrowser/mainwindow/statusbar/bar.py +++ b/qutebrowser/mainwindow/statusbar/bar.py @@ -106,90 +106,56 @@ class StatusBar(QWidget): _caret_mode = CaretMode.off STYLESHEET = """ - QWidget#StatusBar { + + QWidget#StatusBar, + QWidget#StatusBar * { + {{ font['statusbar'] }} {{ color['statusbar.bg'] }} - } - - QWidget#StatusBar QLabel { {{ color['statusbar.fg'] }} } - QWidget#StatusBar QLineEdit { - {{ color['statusbar.fg'] }} - } - - QWidget#StatusBar[caret_mode="on"] QLabel { + QWidget#StatusBar[caret_mode="on"], + QWidget#StatusBar[caret_mode="on"] * { {{ color['statusbar.fg.caret'] }} - } - - QWidget#StatusBar[caret_mode="on"] { {{ color['statusbar.bg.caret'] }} } - QWidget#StatusBar[caret_mode="selection"] QLabel { + QWidget#StatusBar[caret_mode="selection"], + QWidget#StatusBar[caret_mode="selection"] * { {{ color['statusbar.fg.caret-selection'] }} - } - - QWidget#StatusBar[caret_mode="selection"] { {{ color['statusbar.bg.caret-selection'] }} } - QWidget#StatusBar[prompt_active="true"] { - {{ color['statusbar.bg.prompt'] }} - } - - QWidget#StatusBar[severity="error"] { + QWidget#StatusBar[severity="error"], + QWidget#StatusBar[severity="error"] * { + {{ color['statusbar.fg.error'] }} {{ color['statusbar.bg.error'] }} } - QWidget#StatusBar[severity="error"] QLabel { - {{ color['statusbar.fg.error'] }} - } - - QWidget#StatusBar[severity="warning"] { + QWidget#StatusBar[severity="warning"], + QWidget#StatusBar[severity="warning"] * { + {{ color['statusbar.fg.warning'] }} {{ color['statusbar.bg.warning'] }} } - QWidget#StatusBar[severity="warning"] QLabel { - {{ color['statusbar.fg.warning'] }} - } - - QWidget#StatusBar[prompt_active="true"] { + QWidget#StatusBar[prompt_active="true"], + QWidget#StatusBar[prompt_active="true"] * { + {{ color['statusbar.fg.prompt'] }} {{ color['statusbar.bg.prompt'] }} } - QWidget#StatusBar[prompt_active="true"] QLabel { - {{ color['statusbar.fg.prompt'] }} - } - - QWidget#StatusBar[prompt_active="true"] QLineEdit { - {{ color['statusbar.fg.prompt'] }} - } - - QWidget#StatusBar[insert_active="true"] { + QWidget#StatusBar[insert_active="true"], + QWidget#StatusBar[insert_active="true"] * { + {{ color['statusbar.fg.insert'] }} {{ color['statusbar.bg.insert'] }} } - QWidget#StatusBar[insert_active="true"] QLabel { - {{ color['statusbar.fg.insert'] }} - } - - QWidget#StatusBar[command_active="true"] { + QWidget#StatusBar[command_active="true"], + QWidget#StatusBar[command_active="true"] * { + {{ color['statusbar.fg.command'] }} {{ color['statusbar.bg.command'] }} } - QWidget#StatusBar[command_active="true"] QLabel { - {{ color['statusbar.fg.command'] }} - } - - QWidget#StatusBar[command_active="true"] QLineEdit { - {{ color['statusbar.fg.command'] }} - } - - QLabel, QLineEdit { - {{ font['statusbar'] }} - } - """ def __init__(self, win_id, parent=None): From 3be9a9b0512c274ec012be1ab174db857a986c4a Mon Sep 17 00:00:00 2001 From: Austin Anderson Date: Wed, 10 Jun 2015 08:16:15 -0400 Subject: [PATCH 15/16] Catalogued a configuration option change for updates. --- qutebrowser/config/config.py | 1 + 1 file changed, 1 insertion(+) diff --git a/qutebrowser/config/config.py b/qutebrowser/config/config.py index e195310ef..02b32c583 100644 --- a/qutebrowser/config/config.py +++ b/qutebrowser/config/config.py @@ -298,6 +298,7 @@ class ConfigManager(QObject): ('colors', 'tab.indicator.system'): 'tabs.indicator.system', ('tabs', 'auto-hide'): 'hide-auto', ('completion', 'history-length'): 'cmd-history-max-items', + ('colors', 'downloads.fg'): 'downloads.fg.start', } DELETED_OPTIONS = [ ('colors', 'tab.separator'), From 9b7b97d6267af4860dba9b8e61856401de98ded7 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 10 Jun 2015 20:55:15 +0200 Subject: [PATCH 16/16] Improve docs. --- README.asciidoc | 1 + doc/help/settings.asciidoc | 163 +++++++++++++++++++++++-------- qutebrowser/config/configdata.py | 13 ++- 3 files changed, 131 insertions(+), 46 deletions(-) diff --git a/README.asciidoc b/README.asciidoc index 547d940e7..e1706d8e7 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -140,6 +140,7 @@ Contributors, sorted by the number of commits in descending order: * Claude * Lamar Pavel * Martin Tournoij +* Austin Anderson * Artur Shaik * Antoni Boucher * ZDarian diff --git a/doc/help/settings.asciidoc b/doc/help/settings.asciidoc index 3b6319af9..837f84a3e 100644 --- a/doc/help/settings.asciidoc +++ b/doc/help/settings.asciidoc @@ -187,13 +187,21 @@ |<>|Top border color of the completion widget category headers. |<>|Bottom border color of the selected completion item. |<>|Foreground color of the matched text in the completion. -|<>|Foreground color of the statusbar. |<>|Foreground color of the statusbar. +|<>|Foreground color of the statusbar. +|<>|Foreground color of the statusbar if there was an error. |<>|Background color of the statusbar if there was an error. +|<>|Foreground color of the statusbar if there is a warning. |<>|Background color of the statusbar if there is a warning. +|<>|Foreground color of the statusbar if there is a prompt. |<>|Background color of the statusbar if there is a prompt. +|<>|Foreground color of the statusbar in insert mode. |<>|Background color of the statusbar in insert mode. +|<>|Foreground color of the statusbar in command mode. +|<>|Background color of the statusbar in command mode. +|<>|Foreground color of the statusbar in caret mode. |<>|Background color of the statusbar in caret mode. +|<>|Foreground color of the statusbar in caret mode with a selection |<>|Background color of the statusbar in caret mode with a selection |<>|Background color of the progress bar. |<>|Default foreground color of the URL in the statusbar. @@ -202,10 +210,10 @@ |<>|Foreground color of the URL in the statusbar when there's a warning. |<>|Foreground color of the URL in the statusbar for hovered links. |<>|Foreground color of unselected odd tabs. -|<>|Foreground color of unselected even tabs. -|<>|Foreground color of selected tabs. |<>|Background color of unselected odd tabs. +|<>|Foreground color of unselected even tabs. |<>|Background color of unselected even tabs. +|<>|Foreground color of selected tabs. |<>|Background color of selected tabs. |<>|Background color of the tab bar. |<>|Color gradient start for the tab indicator. @@ -213,13 +221,16 @@ |<>|Color for the tab indicator on errors.. |<>|Color gradient interpolation system for the tab indicator. |<>|Font color for hints. -|<>|Font color for the matched part of hints. |<>|Background color for hints. -|<>|Foreground color for downloads. +|<>|Font color for the matched part of hints. |<>|Background color for the download bar. -|<>|Color gradient start for downloads. -|<>|Color gradient end for downloads. -|<>|Color gradient interpolation system for downloads. +|<>|Color gradient start for download text. +|<>|Color gradient start for download backgrounds. +|<>|Color gradient end for download text. +|<>|Color gradient stop for download backgrounds. +|<>|Color gradient interpolation system for download text. +|<>|Color gradient interpolation system for download backgrounds. +|<>|Foreground color for downloads with errors. |<>|Background color for downloads with errors. |<>|Background color for webpages if unset (or empty to use the theme's color) |============== @@ -1465,6 +1476,8 @@ A value can be in one of the following format: * `hsv(h, s, v)` / `hsva(h, s, v, a)` (values 0-255, hue 0-359) * A gradient as explained in http://qt-project.org/doc/qt-4.8/stylesheet-reference.html#list-of-property-types[the Qt documentation] under ``Gradient''. +A *.system value determines the color system to use for color interpolation between similarly-named *.start and *.stop entries, regardless of how they are defined in the options. Valid values are 'rgb', 'hsv', and 'hsl'. + The `hints.*` values are a special case as they're real CSS colors, not Qt-CSS colors. There, for a gradient, you need to use `-webkit-gradient`, see https://www.webkit.org/blog/175/introducing-css-gradients/[the WebKit documentation]. [[colors-completion.fg]] @@ -1539,17 +1552,23 @@ Foreground color of the matched text in the completion. Default: +pass:[#ff4444]+ +[[colors-statusbar.fg]] +=== statusbar.fg +Foreground color of the statusbar. + +Default: +pass:[white]+ + [[colors-statusbar.bg]] === statusbar.bg Foreground color of the statusbar. Default: +pass:[black]+ -[[colors-statusbar.fg]] -=== statusbar.fg -Foreground color of the statusbar. +[[colors-statusbar.fg.error]] +=== statusbar.fg.error +Foreground color of the statusbar if there was an error. -Default: +pass:[white]+ +Default: +pass:[${statusbar.fg}]+ [[colors-statusbar.bg.error]] === statusbar.bg.error @@ -1557,30 +1576,72 @@ Background color of the statusbar if there was an error. Default: +pass:[red]+ +[[colors-statusbar.fg.warning]] +=== statusbar.fg.warning +Foreground color of the statusbar if there is a warning. + +Default: +pass:[${statusbar.fg}]+ + [[colors-statusbar.bg.warning]] === statusbar.bg.warning Background color of the statusbar if there is a warning. Default: +pass:[darkorange]+ +[[colors-statusbar.fg.prompt]] +=== statusbar.fg.prompt +Foreground color of the statusbar if there is a prompt. + +Default: +pass:[${statusbar.fg}]+ + [[colors-statusbar.bg.prompt]] === statusbar.bg.prompt Background color of the statusbar if there is a prompt. Default: +pass:[darkblue]+ +[[colors-statusbar.fg.insert]] +=== statusbar.fg.insert +Foreground color of the statusbar in insert mode. + +Default: +pass:[${statusbar.fg}]+ + [[colors-statusbar.bg.insert]] === statusbar.bg.insert Background color of the statusbar in insert mode. Default: +pass:[darkgreen]+ +[[colors-statusbar.fg.command]] +=== statusbar.fg.command +Foreground color of the statusbar in command mode. + +Default: +pass:[${statusbar.fg}]+ + +[[colors-statusbar.bg.command]] +=== statusbar.bg.command +Background color of the statusbar in command mode. + +Default: +pass:[${statusbar.bg}]+ + +[[colors-statusbar.fg.caret]] +=== statusbar.fg.caret +Foreground color of the statusbar in caret mode. + +Default: +pass:[${statusbar.fg}]+ + [[colors-statusbar.bg.caret]] === statusbar.bg.caret Background color of the statusbar in caret mode. Default: +pass:[purple]+ +[[colors-statusbar.fg.caret-selection]] +=== statusbar.fg.caret-selection +Foreground color of the statusbar in caret mode with a selection + +Default: +pass:[${statusbar.fg}]+ + [[colors-statusbar.bg.caret-selection]] === statusbar.bg.caret-selection Background color of the statusbar in caret mode with a selection @@ -1629,30 +1690,30 @@ Foreground color of unselected odd tabs. Default: +pass:[white]+ -[[colors-tabs.fg.even]] -=== tabs.fg.even -Foreground color of unselected even tabs. - -Default: +pass:[white]+ - -[[colors-tabs.fg.selected]] -=== tabs.fg.selected -Foreground color of selected tabs. - -Default: +pass:[white]+ - [[colors-tabs.bg.odd]] === tabs.bg.odd Background color of unselected odd tabs. Default: +pass:[grey]+ +[[colors-tabs.fg.even]] +=== tabs.fg.even +Foreground color of unselected even tabs. + +Default: +pass:[white]+ + [[colors-tabs.bg.even]] === tabs.bg.even Background color of unselected even tabs. Default: +pass:[darkgrey]+ +[[colors-tabs.fg.selected]] +=== tabs.fg.selected +Foreground color of selected tabs. + +Default: +pass:[white]+ + [[colors-tabs.bg.selected]] === tabs.bg.selected Background color of selected tabs. @@ -1701,23 +1762,17 @@ Font color for hints. Default: +pass:[black]+ -[[colors-hints.fg.match]] -=== hints.fg.match -Font color for the matched part of hints. - -Default: +pass:[green]+ - [[colors-hints.bg]] === hints.bg Background color for hints. Default: +pass:[-webkit-gradient(linear, left top, left bottom, color-stop(0%,#FFF785), color-stop(100%,#FFC542))]+ -[[colors-downloads.fg]] -=== downloads.fg -Foreground color for downloads. +[[colors-hints.fg.match]] +=== hints.fg.match +Font color for the matched part of hints. -Default: +pass:[#ffffff]+ +Default: +pass:[green]+ [[colors-downloads.bg.bar]] === downloads.bg.bar @@ -1725,21 +1780,33 @@ Background color for the download bar. Default: +pass:[black]+ +[[colors-downloads.fg.start]] +=== downloads.fg.start +Color gradient start for download text. + +Default: +pass:[white]+ + [[colors-downloads.bg.start]] === downloads.bg.start -Color gradient start for downloads. +Color gradient start for download backgrounds. Default: +pass:[#0000aa]+ +[[colors-downloads.fg.stop]] +=== downloads.fg.stop +Color gradient end for download text. + +Default: +pass:[${downloads.fg.start}]+ + [[colors-downloads.bg.stop]] === downloads.bg.stop -Color gradient end for downloads. +Color gradient stop for download backgrounds. Default: +pass:[#00aa00]+ -[[colors-downloads.bg.system]] -=== downloads.bg.system -Color gradient interpolation system for downloads. +[[colors-downloads.fg.system]] +=== downloads.fg.system +Color gradient interpolation system for download text. Valid values: @@ -1749,6 +1816,24 @@ Valid values: Default: +pass:[rgb]+ +[[colors-downloads.bg.system]] +=== downloads.bg.system +Color gradient interpolation system for download backgrounds. + +Valid values: + + * +rgb+: Interpolate in the RGB color system. + * +hsv+: Interpolate in the HSV color system. + * +hsl+: Interpolate in the HSL color system. + +Default: +pass:[rgb]+ + +[[colors-downloads.fg.error]] +=== downloads.fg.error +Foreground color for downloads with errors. + +Default: +pass:[white]+ + [[colors-downloads.bg.error]] === downloads.bg.error Background color for downloads with errors. diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index ccd71da51..eb1b529c7 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -980,28 +980,27 @@ def data(readonly=False): ('downloads.fg.start', SettingValue(typ.QtColor(), 'white'), - "Color gradient start for download foreground text."), + "Color gradient start for download text."), ('downloads.bg.start', SettingValue(typ.QtColor(), '#0000aa'), - "Color gradient start for download background."), + "Color gradient start for download backgrounds."), ('downloads.fg.stop', SettingValue(typ.QtColor(), '${downloads.fg.start}'), - "Color gradient end for download foreground text."), + "Color gradient end for download text."), ('downloads.bg.stop', SettingValue(typ.QtColor(), '#00aa00'), - "Color gradient stop for download background."), + "Color gradient stop for download backgrounds."), ('downloads.fg.system', SettingValue(typ.ColorSystem(), 'rgb'), - "Color gradient interpolation system for download foreground" - "text."), + "Color gradient interpolation system for download text."), ('downloads.bg.system', SettingValue(typ.ColorSystem(), 'rgb'), - "Color gradient interpolation system for download background."), + "Color gradient interpolation system for download backgrounds."), ('downloads.fg.error', SettingValue(typ.QtColor(), 'white'),