From 5805bc02e2b4621e67516f87bfd671f9321e29ce Mon Sep 17 00:00:00 2001 From: Sniffleupagus Date: Sat, 15 Jul 2023 16:25:09 -0700 Subject: [PATCH] enable color in Image creation with config options --- pwnagotchi/ui/view.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pwnagotchi/ui/view.py b/pwnagotchi/ui/view.py index f452a940..1536d973 100644 --- a/pwnagotchi/ui/view.py +++ b/pwnagotchi/ui/view.py @@ -18,8 +18,8 @@ from pwnagotchi.voice import Voice import RPi.GPIO as GPIO -WHITE = 0xff -BLACK = 0x00 +WHITE = 0x181010 +BLACK = 0xffcccc ROOT = None @@ -124,7 +124,7 @@ class View(object): while True: try: name = self._state.get('name') - self.set('name', name.rstrip('█').strip() if '█' in name else (name + ' █')) + self.set('name', name.rstrip('-').strip() if '-' in name else (name + ' -')) self.update() except Exception as e: logging.warning("non fatal error while updating view: %s" % e) @@ -373,7 +373,9 @@ class View(object): state = self._state changes = state.changes(ignore=self._ignore_changes) if force or len(changes): - self._canvas = Image.new('1', (self._width, self._height), WHITE) + colormode = '1' if not 'colormode' in self._config['ui'] else self._config['ui']['colormode'] + backgroundcolor = WHITE if not 'backgroundcolor' in self._config['ui'] else self._config['ui']['backgroundcolor'] + self._canvas = Image.new(colormode, (self._width, self._height), backgroundcolor) drawer = ImageDraw.Draw(self._canvas) plugins.on('ui_update', self)