Пример #1
0
def main():
    for b in range(8):
        print ansi_escapes.background(b),
        for f in range(8):
            print '%s%s%s%s%s' % (
                ansi_escapes.foreground(f),
                ansi_escapes.bold(),
                'hello ',
                ansi_escapes.no_bold(),
                'world'),
        print ansi_escapes.no_colour()

    term = os.environ.get('TERM', '')
    if '256' in term or term == 'linux':
        for foregound in ['8b4513', '00ff7f', 'ff1493']:
            print ansi_escapes.foreground_string(
                'hello', colour_numbers.html_to_integer(foregound))
        print ansi_escapes.no_colour()
Пример #2
0
def test():
    return ansi_escapes.foreground_string(
        'hello', colour_numbers.html_to_integer('0x00FF00'))
Пример #3
0
def colour_text(string, name):
    number = colour_numbers.name_to_number(name)
    if not number:
        return string
    return ansi_escapes.foreground_string(string, number)