mirror of
https://github.com/jayofelony/pwnagotchi.git
synced 2025-07-01 18:37:27 -04:00
enable color in Image creation with config options
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user