From 2a2791448a4887667d9cfb462a2d84dd8db03b68 Mon Sep 17 00:00:00 2001 From: chrys Date: Mon, 14 Aug 2017 00:40:08 +0200 Subject: [PATCH] fix colors --- play zone/colors.sh | 39 +++++++++++++++++++++++++++ src/fenrir/screenDriver/vcsaDriver.py | 20 +++++++------- 2 files changed, 49 insertions(+), 10 deletions(-) create mode 100644 play zone/colors.sh diff --git a/play zone/colors.sh b/play zone/colors.sh new file mode 100644 index 00000000..7459faf3 --- /dev/null +++ b/play zone/colors.sh @@ -0,0 +1,39 @@ +#!/bin/bash +echo "foreground colors" +echo -e "\e[39mDefault" +echo -e "\e[30mBlack" +echo -e "\e[31mRed" +echo -e "\e[32mGreen" +echo -e "\e[33mYellow" +echo -e "\e[34mBlue" +echo -e "\e[35mMagenta" +echo -e "\e[36mCyan" +echo -e "\e[37mLight gray" +echo -e "\e[90mDark gray" +echo -e "\e[91mLight red" +echo -e "\e[92mLight green" +echo -e "\e[93mLight yellow" +echo -e "\e[94mLight blue" +echo -e "\e[95mLight magenta" +echo -e "\e[96mLight cyan" +echo -e "\e[97mWhite" + +echo "background colors" +echo -e "\e[49mDefault" +echo -e "\e[40mBlack" +echo -e "\e[41mRed" +echo -e "\e[42mGreen" +echo -e "\e[43mYellow" +echo -e "\e[44mBlue" +echo -e "\e[45mMagenta" +echo -e "\e[46mCyan" +echo -e "\e[47mLight gray" +echo -e "\e[100mDark gray" +echo -e "\e[101mLight red" +echo -e "\e[102mLight green" +echo -e "\e[103mLight yellow" +echo -e "\e[104mLight blue" +echo -e "\e[105mLight magenta" +echo -e "\e[106mLight cyan" +echo -e "\e[107mWhite" + diff --git a/src/fenrir/screenDriver/vcsaDriver.py b/src/fenrir/screenDriver/vcsaDriver.py index c79fd3e2..274ba76d 100644 --- a/src/fenrir/screenDriver/vcsaDriver.py +++ b/src/fenrir/screenDriver/vcsaDriver.py @@ -35,8 +35,8 @@ class driver(): self.vcsaDevicePath = '/dev/vcsa' self.ListSessions = None self.charmap = {} - self.bgColorNames = {0: _('black'), 1: _('blue'), 2: _('green'), 3: _('cyan'), 4: _('red'), 5: _('purple'), 6: _('brown/yellow'), 7: _('white')} - self.fgColorNames = {8: _('black'), 9: _('blue'), 10: _('green'), 11: _('cyan'), 12: _('red'), 13: _('purple'), 14: _('brown/yellow'), 15: _('white')} + self.bgColorNames = {0: _('black'), 1: _('blue'), 2: _('green'), 3: _('cyan'), 4: _('red'), 5: _('Magenta'), 6: _('brown/yellow'), 7: _('white')} + self.fgColorNames = {0: _('Black'), 1: _('Blue'), 2: _('Green'), 3: _('Cyan'), 4: _('Red'), 5: _('Magenta'), 6: _('brown/yellow'), 7: _('Light gray'), 8: _('Dark gray'), 9: _('Light blue'), 10: ('Light green'), 11: _('Light cyan'), 12: _('Light red'), 13: _('Light magenta'), 14: _('Light yellow'), 15: _('White')} self.hichar = None def initialize(self, environment): self.env = environment @@ -222,11 +222,11 @@ class driver(): ink = attr & 0x0F paper = (attr>>4) & 0x0F blink = 0 - #if attr & 1: - # blink = 1 + if attr & 1: + blink = 1 bold = 0 - #if attr & 16: - # bold = 1 + if attr & 16: + bold = 1 #if (ink != 7) or (paper != 0): # print(ink,paper) if sh & self.hichar: @@ -240,15 +240,15 @@ class driver(): allAttrib += lineAttrib return str(allText), allAttrib def getFenrirBGColor(self, attribute): + print(attribute[2]) try: return self.bgColorNames[attribute[2]] except Exception as e: - print(e) return '' def getFenrirFGColor(self, attribute): try: return self.fgColorNames[attribute[1]] - except: + except Exception as e: return '' def getFenrirUnderline(self, attribute): if attribute[5] == 1: @@ -263,9 +263,9 @@ class driver(): return _('blink') return '' def getFenrirFont(self, attribute): - return _('System Font') + return _('') def getFenrirFontSize(self, attribute): - return _('System Font Size') + return _('') def update(self, trigger='onUpdate'): if trigger == 'onInput': # no need for an update on input for VCSA return