def test(): """ Check a few of the canonical X11 color names """ # access the color map from journal.ANSI import ANSI # and the control sequence generator from journal.CSI import CSI # verify some colors assert ANSI.x11("normal") == CSI.reset() assert ANSI.x11("burlywood") == CSI.csi24(0xde, 0xb8, 0x87) assert ANSI.x11("dark goldenrod") == CSI.csi24(0xb8, 0x86, 0x0b) assert ANSI.x11("dark khaki") == CSI.csi24(0xbd, 0xb7, 0x6b) assert ANSI.x11("dark orange") == CSI.csi24(0xff, 0x8c, 0x00) assert ANSI.x11("dark sea green") == CSI.csi24(0x8f, 0xbc, 0x8f) assert ANSI.x11("firebrick") == CSI.csi24(0xb2, 0x22, 0x22) assert ANSI.x11("hot pink") == CSI.csi24(0xff, 0x69, 0xb4) assert ANSI.x11("indian red") == CSI.csi24(0xcd, 0x5c, 0x5c) assert ANSI.x11("lavender") == CSI.csi24(0xe6, 0xe6, 0xfa) assert ANSI.x11("light green") == CSI.csi24(0x90, 0xee, 0x90) assert ANSI.x11("light steel blue") == CSI.csi24(0xb0, 0xc4, 0xde) assert ANSI.x11("light slate gray") == CSI.csi24(0x77, 0x88, 0x99) assert ANSI.x11("lime green") == CSI.csi24(0x32, 0xcd, 0x32) assert ANSI.x11("navajo white") == CSI.csi24(0xff, 0xde, 0xad) assert ANSI.x11("olive drab") == CSI.csi24(0x6b, 0x8e, 0x23) assert ANSI.x11("peach puff") == CSI.csi24(0xff, 0xda, 0xb9) assert ANSI.x11("steel blue") == CSI.csi24(0x46, 0x82, 0xb4) # all done return
def test(): """ Check a few of the canonical ANSI color names """ # access the color map from journal.ANSI import ANSI # and the control sequence generator from journal.CSI import CSI # verify the contents of the {ansi} color table # the reset sequence assert ANSI.ansi("normal") == CSI.reset() # regular colors assert ANSI.ansi("black") == CSI.csi3(code=30) assert ANSI.ansi("red") == CSI.csi3(code=31) assert ANSI.ansi("green") == CSI.csi3(code=32) assert ANSI.ansi("brown") == CSI.csi3(code=33) assert ANSI.ansi("blue") == CSI.csi3(code=34) assert ANSI.ansi("purple") == CSI.csi3(code=35) assert ANSI.ansi("cyan") == CSI.csi3(code=36) assert ANSI.ansi("light-gray") == CSI.csi3(code=37) # bright colors assert ANSI.ansi("dark-gray") == CSI.csi3(code=30, bright=True) assert ANSI.ansi("light-red") == CSI.csi3(code=31, bright=True) assert ANSI.ansi("light-green") == CSI.csi3(code=32, bright=True) assert ANSI.ansi("yellow") == CSI.csi3(code=33, bright=True) assert ANSI.ansi("light-blue") == CSI.csi3(code=34, bright=True) assert ANSI.ansi("light-purple") == CSI.csi3(code=35, bright=True) assert ANSI.ansi("light-cyan") == CSI.csi3(code=36, bright=True) assert ANSI.ansi("white") == CSI.csi3(code=37, bright=True) # all done return
def test(): """ Check a few of the miscellaneous color names """ # access the color map from journal.ANSI import ANSI # and the control sequence generator from journal.CSI import CSI # verify the contents of the {gray} color table # the reset sequence assert ANSI.misc("normal") == CSI.reset() # my picks assert ANSI.misc("amber") == CSI.csi24(0xff, 0xbf, 0x00) assert ANSI.misc("sage") == CSI.csi24(176, 208, 176) # all done return
def test(): """ Verify we can build escape sequences correctly """ # get the modules from journal.CSI import CSI from journal.ASCII import ASCII # get the escape character esc = ASCII.ESC # verify the escape sequence generation routines build the correct strings assert CSI.reset() == f"{esc}[0m" assert CSI.csi3(code=35) == f"{esc}[0;35m" assert CSI.csi8(red=4, green=2, blue=3) == f"{esc}[38;5;175m" assert CSI.csi8_gray(gray=16) == f"{esc}[38;5;248m" assert CSI.csi24(red=0xff, green=0xbf, blue=0x00) == f"{esc}[38;2;255;191;0m" # all done return
def test(): """ Check a few of the canonical greay tones """ # access the color map from journal.ANSI import ANSI # and the control sequence generator from journal.CSI import CSI # verify the contents of the {gray} color table # the reset sequence assert ANSI.gray("normal") == CSI.reset() # verify the contents of the {gray} color table assert ANSI.gray("gray10") == CSI.csi24(red=0x19, green=0x19, blue=0x19) assert ANSI.gray("gray30") == CSI.csi24(red=0x4c, green=0x4c, blue=0x4c) assert ANSI.gray("gray41") == CSI.csi24(red=0x69, green=0x69, blue=0x69) assert ANSI.gray("gray50") == CSI.csi24(red=0x80, green=0x80, blue=0x80) assert ANSI.gray("gray66") == CSI.csi24(red=0xa9, green=0xa9, blue=0xa9) assert ANSI.gray("gray75") == CSI.csi24(red=0xbe, green=0xbe, blue=0xbe) # all done return