from autopalette import af, GameBoyGreenPalette

af.init(palette=GameBoyGreenPalette)

print(af("There you are!").h1)
Example #2
0
from autopalette import af

af.init(fix_text=True)

print(af("¯\\_(ã\x83\x84)_/¯").info)
Example #3
0
from autopalette import af, DutronPalette

af.init()
af.init(palette=DutronPalette)

print(af("No formatting."))

print(af("Hashed color.").id)

print(af("Plain text, colored within palette.").p)
print(af("Light text.").light)
print(af("Dark text.").dark)

print(af("Header One").h1)
print(af("Header Two").h2)
print(af("Header Three").h3)
print(af("Header Four").h4)

print(af("List element").li)

print(af("An error!").err)
print(af("A warning.").warn)
print(af("Some information.").info)
print(af("All is good.").ok)

print(af("Bold").b)
print(af("Muted").m)
print(af("Italic").i)
print(af("Underline").u)
print(af("Reversed").r)
Example #4
0
#!/usr/bin/env python3
import unicodedata
import grapheme
from autopalette import af

af.init(term_colors=256)


def save_cursor():
    return f'\x1b[s'


def restore_cursor():
    return f'\x1b[u'


def move_cursor_left(n):
    return f'\x1b[{n}D'


def adjust_spaces(text):
    fixed_length = len(unicodedata.normalize('NFKD', text))
    unicode_length = grapheme.length(text)
    if unicode_length != fixed_length:
        _text = ' ' * fixed_length
        _text += save_cursor()
        _text += move_cursor_left(fixed_length)
        _text += unicodedata.normalize('NFKD', text)
        _text += restore_cursor()
        return _text
    return text
Example #5
0
from autopalette import af

af.init(fix_all=True)

print(af("I 💛 Unicode!"))