config: barpyrus: config.py: add colordict and frame-function

Instead of using rgb-colorvalues everywhere there now is a dictionary
with a set of colors + colorvalues so adjusting colors won't be too
annoying in the future. Also instead of creating a frame-variable for
every possible color combination there now is a function to create
frames when necessary.
This commit is contained in:
Thomas Preisner 2018-03-01 22:27:44 +01:00
parent 2e3f4c3c65
commit 66e91a3308

View file

@ -26,12 +26,29 @@ else:
text_font = '*-*-lucidatypewriter-medium-*-*-*-12-*-*-*-*-*-*-*'
symbol_font = '*-wuncon-siji-medium-r-normal-*-12-100-100-*-c-80-iso10646-1'
# create color-dict for often used colors
color = {
'black': '#000000',
'grey': '#303030',
'lightgrey':'#989898',
'white': '#EFEFEF',
'orange': '#FFA500',
'yellow': '#FFFD00',
'green': '#19CB00',
'cyan': '#0DCDCD',
'lightblue':'#8470FF',
'blue': '#0026FF',
'magenta': '#CB1ED1',
'red': '#CC0403',
}
# function to create colored frames
def frame(content, bg, fg, padding = (3, 3)):
return Theme(bg = color[bg], fg = color[fg], padding = padding)(content)
# get space for the panel
hc(['pad', str(monitor), str(height)])
# theme for grey frame:
grey_frame = Theme(bg = '#303030', fg = '#EFEFEF', padding = (3,3))
# initialize lemonbar
bar = lemonbar.Lemonbar(geometry = (x, y, width, height),
font = text_font, symbol_font = symbol_font)
@ -44,10 +61,10 @@ bar.widget = W.ListLayout([
W.RawLabel('%{c}'),
hlwm.HLWMMonitorFocusLayout(hc, monitor,
# this widget is shown on the focused monitor:
grey_frame(hlwm.HLWMWindowTitle(hc)),
frame(hlwm.HLWMWindowTitle(hc), 'grey', 'white'),
# this widget is shown on all unfocused monitors:
W.RawLabel('')),
W.RawLabel('%{r}'),
grey_frame(W.DateTime('%d. %B, %H:%M')),
frame(W.DateTime('%d. %B, %H:%M'), 'grey', 'white'),
])