[bitbake-devel] [PATCH v2] bitbake: Colorize knotty interactive console output

Jason Wessel jason.wessel at windriver.com
Tue Nov 13 22:36:14 UTC 2012


On 11/13/2012 09:22 AM, Richard Purdie wrote:
> On Tue, 2012-11-13 at 08:45 -0600, Seth Bollinger wrote:
>> I'm not sure how best to resolve this.  Would you like me to add some
>> code to try and detect background color?  This seems like it might be
>> more complex than it's worth...
>>
>> Or would it be better to have a selectable light background color
>> set?  If you think light background is more common (I dislike staring
>> at large blocks of white :)) it could default to the light color set.
> I have not looked into this and am not an expert on terminals and colour
> control of them. I don't know how we can solve this but the current
> situation where it prints white on white on my terminal is clearly
> unacceptable. This has to be a problem others have run into and solved
> before though...


If you are planning to colorize things, my recommendation would be to take the "middle ground" and use the transparency instead of using white which should work in general on any modern terminal.

Change the patch a bit like this:
+    color_enabled = False
+    BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = range(30,38)

    BASECOLOR, BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = range(29,38)

+
+    COLORS = {
+        DEBUG3  : CYAN,
+        DEBUG2  : CYAN,
+        DEBUG   : CYAN,
+        VERBOSE : BASECOLOR,
+        NOTE    : BASECOLOR,
+        PLAIN   : BASECOLOR,
+        WARNING : YELLOW,
+        ERROR   : RED,
+        CRITICAL: RED,
+    }


Most of the time terminals are either "dark" or "light", and default color is always set to -1 in the curses interface.  For example, the attached patch will allow the patch to work on my "lawngreen" default xterms as well as more typical defaults for gnome-terminal or rxvt.

Cheers,
Jason.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: colors.diff
Type: application/mbox
Size: 704 bytes
Desc: not available
URL: <http://lists.openembedded.org/pipermail/bitbake-devel/attachments/20121113/8e8de072/attachment-0001.mbox>


More information about the bitbake-devel mailing list