#!/usr/bin/env python """ Demonstration of how to print using the HTML class. """ from prompt_toolkit import HTML, print_formatted_text print = print_formatted_text def title(text): print(HTML("\n{}").format(text)) def main(): title("Special formatting") print(HTML(" Bold")) print(HTML(" Blink")) print(HTML(" Italic")) print(HTML(" Reverse")) print(HTML(" Underline")) print(HTML(" Strike")) print(HTML(" Hidden (hidden)")) # Ansi colors. title("ANSI colors") print(HTML(" ANSI Red")) print(HTML(" ANSI Blue")) # Other named colors. title("Named colors") print(HTML(" orange")) print(HTML(" purple")) # Background colors. title("Background colors") print(HTML(' ')) print(HTML(' ')) # Interpolation. title("HTML interpolation (see source)") print(HTML(" {}").format("")) print(HTML(" {text}").format(text="")) print(HTML(" %s") % ("",)) print() if __name__ == "__main__": main()