diff --git a/examples/pywmgeneric.py b/examples/pywmgeneric.py index d28f59e..6b48674 100644 --- a/examples/pywmgeneric.py +++ b/examples/pywmgeneric.py @@ -643,12 +643,18 @@ def main(): '#': '#9E79A2899E79', '$': '#410341034103', } + palette['o'] = clConfig.get('indicator', '#2020b2b2aaaa') palette['/'] = clConfig.get('graph', '#2020b2b2aaaa') palette['-'] = clConfig.get('graphbg', '#707070707070') - palette['_'] = clConfig.get('background', '#000000000000') + palette['_'] = clConfig.get('background', '#FFFFFFFFFFFF') palette['%'] = clConfig.get('text', '#2081B2CAAEBA') + palette['.'] = 'grey95' + palette['x'] = 'black' + palette['o'] = 'grey45' + palette['-'] = 'grey65' + font = clConfig.get('font', '6x8') configFile = clConfig.get('configfile', defaultConfigFile) diff --git a/examples/pywmhdmon.py b/examples/pywmhdmon.py index f5d6a26..f095411 100755 --- a/examples/pywmhdmon.py +++ b/examples/pywmhdmon.py @@ -414,6 +414,11 @@ def main(): palette[8] = clConfig.get('barbgcolor', 'cyan4') palette[5] = clConfig.get('activitycolor', 'cyan2') + palette['.'] = 'grey85' + palette['x'] = 'black' + palette['o'] = 'grey45' + palette['-'] = 'grey65' + font = clConfig.get('font', '6x8') global char_width, char_height diff --git a/wmdocklib/pywmhelpers.py b/wmdocklib/pywmhelpers.py index 1924d0d..9a71d81 100644 --- a/wmdocklib/pywmhelpers.py +++ b/wmdocklib/pywmhelpers.py @@ -250,7 +250,13 @@ def initPixmap(background=None, def readFont(font_name): # read xpm, skip header and color definitions, fill/trim to 48 lines. + font_palette = {} fontdef = readXPM(__file__[:__file__.rfind(os.sep) + 1] + font_name + '.xpm') + colorCount = int(fontdef[0].split(' ')[2]) + for i in range(colorCount): + colorChar = fontdef[i+1][0] + colorName = fontdef[i+1][1:].split()[1] + font_palette[colorChar] = colorName fontdef = fontdef[1 + int(fontdef[0].split(' ')[2]):] fontdef = (fontdef + [' '*128]*48)[:48] @@ -259,10 +265,11 @@ def initPixmap(background=None, if not m: raise ValueError("can't infer font size from name (does not contain wxh)") width, height = [int(item) for item in m.groups()] - return width, height, fontdef + return width, height, fontdef, font_palette global char_width, char_height - char_width, char_height, fontdef = readFont(font_name) + char_width, char_height, fontdef, font_palette = readFont(font_name) + palette.update(font_palette) global charset_start, charset_width charset_start = height + len(patterns)