Skip to content

Instantly share code, notes, and snippets.

@dab
Created December 11, 2018 17:43
Show Gist options
  • Save dab/338e16b25d50a1eeb80d09e609f4502e to your computer and use it in GitHub Desktop.
Save dab/338e16b25d50a1eeb80d09e609f4502e to your computer and use it in GitHub Desktop.
qutebrowser config.py with colors from .Xresources
# Autogenerated config.py
# Documentation:
# qute://help/configuring.html
# qute://help/settings.html
# loading color from .Xresources
# hint from https://github.com/qutebrowser/qutebrowser/blob/master/doc/help/configuring.asciidoc#reading-colors-from-xresources
import subprocess
def read_xresources(prefix):
props = {}
x = subprocess.run(['xrdb', '-query'], stdout=subprocess.PIPE)
lines = x.stdout.decode().split('\n')
for line in filter(lambda l : l.startswith(prefix), lines):
prop, _, value = line.partition(':\t')
props[prop] = value
return props
xresources = read_xresources('*')
# now available as xresources variable
# for using like c.colors.statusbar.normal.bg = xresources['*background']
# Uncomment this to still load settings configured via autoconfig.yml
# config.load_autoconfig()
# Enable JavaScript.
# Type: Bool
config.set('content.javascript.enabled', True, 'file://*')
# Enable JavaScript.
# Type: Bool
config.set('content.javascript.enabled', True, 'chrome://*/*')
# Enable JavaScript.
# Type: Bool
config.set('content.javascript.enabled', True, 'qute://*/*')
config.set('tabs.padding', { 'top': 15, 'bottom': 15, 'left': 10, 'right': 10 })
config.set('zoom.default', '150%')
# Default monospace fonts. Whenever "monospace" is used in a font
# setting, it's replaced with the fonts listed here.
# Type: Font
c.fonts.monospace = '"IBM Plex Mono", Terminus, Monospace, "DejaVu Sans Mono", Monaco, "Bitstream Vera Sans Mono", "Andale Mono", "Courier New", Courier, "Liberation Mono", monospace, Fixed, Consolas, Terminal'
# Font family for standard fonts.
# Type: FontFamily
c.fonts.web.family.standard = '"IBM Plex Sans", "Roboto Condensed", sans-serif'
c.fonts.web.family.sans_serif = '"IBM Plex Sans", "Roboto Condensed", sans-serif'
c.fonts.web.family.serif = '"IBM Plex Serif", "Roboto Condensed", serif'
# Font used in the completion widget.
# Type: Font
c.fonts.completion.entry = '7pt monospace'
# Font used in the completion categories.
# Type: Font
c.fonts.completion.category = 'bold 7pt monospace'
# Font used for the debugging console.
# Type: QtFont
c.fonts.debug_console = '7pt monospace'
# Font used for the downloadbar.
# Type: Font
c.fonts.downloads = '7pt monospace'
# Font used for the hints.
# Type: Font
c.fonts.hints = 'bold 7pt monospace'
# Font used in the keyhint widget.
# Type: Font
c.fonts.keyhint = '7pt monospace'
# Font used for error messages.
# Type: Font
c.fonts.messages.error = '7pt monospace'
# Font used for info messages.
# Type: Font
c.fonts.messages.info = '7pt monospace'
# Font used for warning messages.
# Type: Font
c.fonts.messages.warning = '7pt monospace'
# Font used for prompts.
# Type: Font
c.fonts.prompts = '7pt sans-serif'
# Font used in the statusbar.
# Type: Font
c.fonts.statusbar = '7pt monospace'
# Font used in the tab bar.
# Type: QtFont
c.fonts.tabs = '7pt "Roboto Condensed"'
# Base16 qutebrowser template by theova
# iA theme by @dab
base00 = xresources['*color0']
base01 = xresources['*color1']
base02 = xresources['*color2']
base03 = xresources['*color3']
base04 = xresources['*color4']
base05 = xresources['*color5']
base06 = xresources['*color6']
base07 = xresources['*color7']
base08 = xresources['*color8']
base09 = xresources['*color9']
base0A = xresources['*color10']
base0B = xresources['*color11']
base0C = xresources['*color12']
base0D = xresources['*color13']
base0E = xresources['*color14']
base0F = xresources['*color15']
# set qutebrowser colors
# Text color of the completion widget. May be a single color to use for
# all columns or a list of three colors, one for each column.
c.colors.completion.fg = base05
# Background color of the completion widget for odd rows.
c.colors.completion.odd.bg = base08
# Background color of the completion widget for even rows.
c.colors.completion.even.bg = base00
# Foreground color of completion widget category headers.
c.colors.completion.category.fg = base0A
# Background color of the completion widget category headers.
c.colors.completion.category.bg = base00
# Top border color of the completion widget category headers.
c.colors.completion.category.border.top = base00
# Bottom border color of the completion widget category headers.
c.colors.completion.category.border.bottom = base00
# Foreground color of the selected completion item.
c.colors.completion.item.selected.fg = base00
# Background color of the selected completion item.
c.colors.completion.item.selected.bg = base0A
# Top border color of the completion widget category headers.
c.colors.completion.item.selected.border.top = base0A
# Bottom border color of the selected completion item.
c.colors.completion.item.selected.border.bottom = base0A
# Foreground color of the matched text in the completion.
c.colors.completion.match.fg = base0B
# Color of the scrollbar handle in the completion view.
c.colors.completion.scrollbar.fg = base05
# Color of the scrollbar in the completion view.
c.colors.completion.scrollbar.bg = base00
# Background color for the download bar.
c.colors.downloads.bar.bg = base00
# Color gradient start for download text.
c.colors.downloads.start.fg = base00
# Color gradient start for download backgrounds.
c.colors.downloads.start.bg = base0D
# Color gradient end for download text.
c.colors.downloads.stop.fg = base00
# Color gradient stop for download backgrounds.
c.colors.downloads.stop.bg = base0C
# Foreground color for downloads with errors.
c.colors.downloads.error.fg = base08
# Font color for hints.
c.colors.hints.fg = base00
# Background color for hints. Note that you can use a `rgba(...)` value
# for transparency.
c.colors.hints.bg = base0A
# Font color for the matched part of hints.
c.colors.hints.match.fg = base05
# Text color for the keyhint widget.
c.colors.keyhint.fg = base05
# Highlight color for keys to complete the current keychain.
c.colors.keyhint.suffix.fg = base05
# Background color of the keyhint widget.
c.colors.keyhint.bg = base00
# Foreground color of an error message.
c.colors.messages.error.fg = base00
# Background color of an error message.
c.colors.messages.error.bg = base08
# Border color of an error message.
c.colors.messages.error.border = base08
# Foreground color of a warning message.
c.colors.messages.warning.fg = base00
# Background color of a warning message.
c.colors.messages.warning.bg = base0E
# Border color of a warning message.
c.colors.messages.warning.border = base0E
# Foreground color of an info message.
c.colors.messages.info.fg = base05
# Background color of an info message.
c.colors.messages.info.bg = base00
# Border color of an info message.
c.colors.messages.info.border = base00
# Foreground color for prompts.
c.colors.prompts.fg = base05
# Border used around UI elements in prompts.
c.colors.prompts.border = base00
# Background color for prompts.
c.colors.prompts.bg = base00
# Background color for the selected item in filename prompts.
c.colors.prompts.selected.bg = base0A
# Foreground color of the statusbar.
c.colors.statusbar.normal.fg = base0B
# Background color of the statusbar.
c.colors.statusbar.normal.bg = base00
# Foreground color of the statusbar in insert mode.
c.colors.statusbar.insert.fg = base00
# Background color of the statusbar in insert mode.
c.colors.statusbar.insert.bg = base0D
# Foreground color of the statusbar in passthrough mode.
c.colors.statusbar.passthrough.fg = base00
# Background color of the statusbar in passthrough mode.
c.colors.statusbar.passthrough.bg = base0C
# Foreground color of the statusbar in private browsing mode.
c.colors.statusbar.private.fg = base00
# Background color of the statusbar in private browsing mode.
c.colors.statusbar.private.bg = base03
# Foreground color of the statusbar in command mode.
c.colors.statusbar.command.fg = base05
# Background color of the statusbar in command mode.
c.colors.statusbar.command.bg = base00
# Foreground color of the statusbar in private browsing + command mode.
c.colors.statusbar.command.private.fg = base05
# Background color of the statusbar in private browsing + command mode.
c.colors.statusbar.command.private.bg = base00
# Foreground color of the statusbar in caret mode.
c.colors.statusbar.caret.fg = base00
# Background color of the statusbar in caret mode.
c.colors.statusbar.caret.bg = base0E
# Foreground color of the statusbar in caret mode with a selection.
c.colors.statusbar.caret.selection.fg = base00
# Background color of the statusbar in caret mode with a selection.
c.colors.statusbar.caret.selection.bg = base0D
# Background color of the progress bar.
c.colors.statusbar.progress.bg = base0D
# Default foreground color of the URL in the statusbar.
c.colors.statusbar.url.fg = base05
# Foreground color of the URL in the statusbar on error.
c.colors.statusbar.url.error.fg = base08
# Foreground color of the URL in the statusbar for hovered links.
c.colors.statusbar.url.hover.fg = base05
# Foreground color of the URL in the statusbar on successful load
# (http).
c.colors.statusbar.url.success.http.fg = base0C
# Foreground color of the URL in the statusbar on successful load
# (https).
c.colors.statusbar.url.success.https.fg = base0B
# Foreground color of the URL in the statusbar when there's a warning.
c.colors.statusbar.url.warn.fg = base0E
# Background color of the tab bar.
c.colors.tabs.bar.bg = base00
# Color gradient start for the tab indicator.
c.colors.tabs.indicator.start = base0D
# Color gradient end for the tab indicator.
c.colors.tabs.indicator.stop = base0C
# Color for the tab indicator on errors.
c.colors.tabs.indicator.error = base08
# Foreground color of unselected odd tabs.
c.colors.tabs.odd.fg = xresources["*foreground"]
# Background color of unselected odd tabs.
c.colors.tabs.odd.bg = base08
# Foreground color of unselected even tabs.
c.colors.tabs.even.fg = xresources["*foreground"]
# Background color of unselected even tabs.
c.colors.tabs.even.bg = base00
# Foreground color of selected odd tabs.
c.colors.tabs.selected.odd.fg = base00
# Background color of selected odd tabs.
c.colors.tabs.selected.odd.bg = xresources["*foreground"]
# Foreground color of selected even tabs.
c.colors.tabs.selected.even.fg = base00
# Background color of selected even tabs.
c.colors.tabs.selected.even.bg = xresources["*foreground"]
# Background color for webpages if unset (or empty to use the theme's
# color).
# c.colors.webpage.bg = base00<Paste>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment