plainbox.impl.color
– ANSI color codes¶
-
class
plainbox.impl.color.
CanonicalColors
[source]¶ Bases:
object
Canonical Color Palette.
Colour is an effective, powerful and instantly recognisable medium for visual communications. To convey the brand personality and brand values, there is a sophisticated colour palette.
We have introduced a palette which includes both a fresh, lively orange, and a rich, mature aubergine. The use of aubergine indicates commercial involvement, while orange is a signal of community engagement.
These colours are used widely in the brand communications, to convey the precise, reliable and free personality.
Ubuntu core colours.
The Ubuntu colour palette has been created to reflect the spirit of our brand.
ubuntu_orange
for a community feel.white
for a clean, fresh and light feel.black
is used in some versions of the brandmark for flexibility of application and where print restrictions apply. It can also be used for body copy.Supporting colours
In addition, there is a supporting colour palette for when communications have a consumer or enterprise focus.
light_aubergine
for a consumer focusdark_aubergine
for an enterprise focusmid_aubergine
for a balance of both
Neutral colours.
For balance. The addition of warm grey softens the combination of orange and aubergine and provides a bridge between the two.
Warm grey can be used for; backgrounds, graphics, pictograms, dot patterns, charts and diagrams. It can also be used for large size text.
cool_grey
For typography, particularly body copy. Black can be quite harsh in combination with aubergine, but grey delivers more balance while still being legible.
Cool grey can also be used within charts and diagrams.
text_grey
- Text grey is used for small size headings, sub-headings and body copy text only.
Canonical core colours.
The Canonical colour palette has been created to reflect the spirit of our brand. Aubergine for a smart, focussed feel. White for a clean, fresh and light feel.
-
black
= (0, 0, 0)¶ Black color
-
canonical_aubergine
= (119, 41, 83)¶ Canonical aubergine color
-
cool_grey
= (51, 51, 51)¶ Cool grey color
-
dark_aubergine
= (44, 0, 30)¶ Dark aubergine color
-
light_aubergine
= (119, 33, 111)¶ Light aubergine color
-
mid_aubergine
= (94, 39, 80)¶ Mid aubergine color
-
small_dot_grey
= (174, 167, 159)¶ Color for small grey dots
-
text_grey
= (51, 51, 51)¶ Text gray color
-
ubuntu_orange
= (221, 72, 20)¶ Ubuntu orange color
-
warm_grey
= (174, 167, 159)¶ Warm grey color
-
white
= (255, 255, 255)¶ White color
-
class
plainbox.impl.color.
Colorizer
(color=None)[source]¶ Bases:
object
Colorizing helper for various kinds of content we need to handle
-
custom
(text, ansi_code)[source]¶ Render a piece of text with custom ANSI styling sequence
Parameters: - text – The text to stylize
- ansi_code – A string containing ANSI escape sequence to use.
Returns: A combination of
ansi_code
,text
and a fixed reset sequence that resets text styles.Note
When the colorizer is not really doing anything (see
is_enabled()
) then custom text is not used at all. This is done to ensure that any custom styling is not permantently enabled if colors are to be disabled.
-
is_enabled
¶ if true, this colorizer is actually using colors
This property is useful to let applications customize their behavior if they know color support is desired and enabled.
-
-
class
plainbox.impl.color.
ansi_off
[source]¶ Bases:
object
-
class
b
¶ Bases:
object
-
BLACK
= ''¶
-
BLUE
= ''¶
-
CYAN
= ''¶
-
GREEN
= ''¶
-
MAGENTA
= ''¶
-
RED
= ''¶
-
RESET
= ''¶
-
WHITE
= ''¶
-
YELLOW
= ''¶
-
-
class
-
class
plainbox.impl.color.
ansi_on
[source]¶ Bases:
object
ANSI control codes for various useful stuff. Reference source: wikipedia
-
class
b
[source]¶ Bases:
object
Background color attributes
-
BLACK
= '\x1b[40m'¶
-
BLUE
= '\x1b[44m'¶
-
CYAN
= '\x1b[46m'¶
-
GREEN
= '\x1b[42m'¶
-
MAGENTA
= '\x1b[45m'¶
-
RED
= '\x1b[41m'¶
-
RESET
= '\x1b[49m'¶
-
WHITE
= '\x1b[47m'¶
-
YELLOW
= '\x1b[44m'¶
-
-
class
-
plainbox.impl.color.
get_color_for_tty
(stream=None)[source]¶ Get
ansi_on
if stdout is a tty,ansi_off
otherwise.Parameters: stream – Alternate stream to use (sys.stdout by default) Returns: ansi_on
oransi_off
, depending on if the stream being a tty or not.
-
plainbox.impl.color.
obj_off
¶ alias of
s
-
plainbox.impl.color.
obj_on
¶ alias of
s