[theme] Add pango markup for prefix/suffix
Add 4 new theme specifiers: - prefixfg - prefixbg - suffixfg - suffixbg All of those are only evaluated if markup type is pango, and result in pango-formatted prefixes/suffixes. fixes #520
This commit is contained in:
parent
3d4ba73460
commit
629b3381f2
2 changed files with 27 additions and 0 deletions
|
@ -249,9 +249,20 @@ class I3BarOutput(object):
|
|||
if not any(state in widget.state() for state in ["warning", "critical"]):
|
||||
return
|
||||
padding = self._theme.padding(widget)
|
||||
|
||||
prefix = self._theme.prefix(widget, padding)
|
||||
suffix = self._theme.suffix(widget, padding)
|
||||
|
||||
if self._config.markup() == "pango":
|
||||
# add prefix/suffix colors
|
||||
fg = self._theme.prefix_fg(widget)
|
||||
bg = self._theme.prefix_bg(widget)
|
||||
prefix = "<span {} {}>{}</span>".format(
|
||||
"foreground='{}'".format(fg) if fg else "",
|
||||
"background='{}'".format(bg) if bg else "",
|
||||
prefix
|
||||
)
|
||||
|
||||
if prefix:
|
||||
full_text = u"{}{}".format(prefix, full_text)
|
||||
if suffix:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue