From 66e91a33082b60e2523e9565ee9b87d1c12a6aa9 Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Thu, 1 Mar 2018 22:27:44 +0100 Subject: [PATCH] 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. --- config/barpyrus/config.py | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/config/barpyrus/config.py b/config/barpyrus/config.py index 9d40459..f8b901e 100644 --- a/config/barpyrus/config.py +++ b/config/barpyrus/config.py @@ -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'), ])