diff options
author | Erik Rose <erik@mozilla.com> | 2011-11-07 21:20:05 -0800 |
---|---|---|
committer | Erik Rose <erik@mozilla.com> | 2011-11-07 21:20:05 -0800 |
commit | e42100c7b42ee175b93a1ecc6f4561d80d599b26 (patch) | |
tree | 31478dfd3ea2701200766f694267c863a2299108 /README.rst | |
parent | fdfd1dac35f0e3912d1398e37fc9881a412fdea8 (diff) | |
download | blessings-e42100c7b42ee175b93a1ecc6f4561d80d599b26.tar.gz |
Add attributes for colors, background colors, and bright colors. Closes #2.
Diffstat (limited to 'README.rst')
-rw-r--r-- | README.rst | 43 |
1 files changed, 35 insertions, 8 deletions
@@ -108,6 +108,35 @@ detail, but I elected to keep Blessings easy to integrate and quick to learn. .. _`terminfo man page`: http://www.manpagez.com/man/5/terminfo/ +Color +----- + +16 colors, both foreground and background, are available as easy-to-remember +attributes:: + + from blessings import Terminal + + term = Terminal() + print term.red + term.bg_green + 'Red on green? Ick!' + term.normal + print term.bright_red + term.bg_bright_blue + 'This is even worse!' + term.normal + +The available colors are... + +* ``black`` +* ``red`` +* ``green`` +* ``yellow`` +* ``blue`` +* ``magenta`` +* ``cyan`` +* ``white`` + +In addition, there is a ``bright`` version of each. If your terminal does not +support the bright palette, it will usually render them as black. + +You can set the background color instead of the foreground by prepending +``bg_``, as in ``bg_blue`` or ``bg_bright_white``. + Parametrized Capabilities ------------------------- @@ -118,15 +147,10 @@ pass the parameters right in:: from blessings import Terminal term = Terminal() - print 'I am ' + term.color(2) + 'green' + term.normal + '!' + print term.create_window(1, 1, 20, 20) -Parametrized capabilities of interest include... - -* ``color`` (takes a number 0-15) -* ``bg_color`` (background color, also takes a number 0-15) - -If you need more, you can also reference any string-returning capability listed -on the `terminfo man page`_ by the name under the "Cap-name" column. +You can reference any string-returning capability listed on the `terminfo man +page`_ by the name under the "Cap-name" column. .. _`terminfo man page`: http://www.manpagez.com/man/5/terminfo/ @@ -186,6 +210,9 @@ Bugs or suggestions? Visit the `issue tracker`_. Version History =============== +1.1 + * Added nicely named attributes for colors. + 1.0 * Extracted Blessings from nose-progressive, my `progress-bar-having, traceback-shortcutting, rootin', tootin' testrunner`_. It provided the |