"Fossies" - the Fresh Open Source Software Archive

Member "ansifilter-2.18/src/testansi.py" (30 Jan 2021, 2906 Bytes) of package /linux/privat/ansifilter-2.18.tar.bz2:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. For more information about "testansi.py" see the Fossies "Dox" file reference documentation.

    1 #!/usr/bin/python
    2 #-*- coding: utf-8 -*-
    3 
    4 print ( "\033[0mAll attributes off\033[0m\n")
    5 print ( "\033[1;4mBold\nBold\nBold\033[0m\n")
    6 print ( "\033[4mUnderline\033[0m\n")
    7 print ( "\033[3mItalic\033[0m\n")
    8 print ( "\033[5mBlink\033[0m\n")
    9 print ( "\033[8mHide\033[0m\n")
   10 print ( "\033[30mBlack\033[0m\n")
   11 print ( "\033[31mRed\nRed\nRed\nRed\033[0m\n")
   12 print ( "\033[32mGreen\033[0m\n")
   13 print ( "\033[33mYellow\033[0m\n")
   14 print ( "\033[34mBlue\033[0m\n")
   15 print ( "\033[35mMagenta\033[0m\n")
   16 print ( "\033[36mCyan\033[0m\n")
   17 print ( "\033[37mWhite\033[0m\n")
   18 
   19 print ( "\033[90mDarkGray Bright\033[0m\n")
   20 print ( "\033[91mRed Bright\033[0m\n")
   21 print ( "\033[92mGreen Bright\033[0m\n")
   22 print ( "\033[93mYellow Bright\033[0m\n")
   23 print ( "\033[94mBlue Bright\033[0m\n")
   24 print ( "\033[95mMagenta Bright\033[0m\n")
   25 print ( "\033[96mCyan Bright\033[0m\n")
   26 print ( "\033[97mWhite Bright\033[0m\n")
   27 
   28 print ( "\033[38mTEST\033[0m\n")
   29 print ( "\033[39mTEST\033[0m\n")
   30 print ( "\033[40m\033[37mBlack Background\033[0m\n")
   31 print ( "\033[41mRed Background\033[0m\n")
   32 print ( "\033[101mRed Background Bright\033[0m\n")
   33 print ( "\033[42mGreen Background\033[0m\n")
   34 print ( "\033[43mYellow Background\033[0m\n")
   35 print ( "\033[44mBlue Background\033[0m\n")
   36 print ( "\033[45mMagenta Background\033[0m\n")
   37 print ( "\033[46mCyan Background\033[0m\n")
   38 print ( "\033[47mWhite Background\033[0m\n")
   39 print ( "\033[48mTEST\033[0m\n")
   40 print ( "\033[49mTEST\033[0m\n")
   41 
   42 print ( "\033[48;5;1;128mTEST 256 Colours\033[0m\n")
   43 print ( "\033[48;28;129mTEST 256 Colours\033[0m\n")
   44 print ( "\033[48;7;132mTEST 256 Colours\033[0m\n")
   45 print ( "\033[48;131mTEST 256 Colours\033[0m\n")
   46 print ( "\033[48;130mTEST 256 Colours\033[0m\n")
   47 print ( "\033[48;32;47mTEST 256 Colours\033[0m\n")
   48 
   49 #alternative CSI
   50 print ( "CSI\23332mGreen ALT CSI\2330mDefault\n")
   51 print ( "CSI\23333mYellow ALT CSI\2330mDefault\n")
   52 print ( "CSI\xc2\x9b33mYellow UTF8 CSI\xc2\x9b0mDefault\n")
   53 
   54 # xterm sequences)
   55 #^[]0;~^G^M^M)
   56 print ( "Delete:\033]0;~\007\015\015")
   57 print ( "Delete:\033]0;New Window title\007\015")
   58 print ( "Delete:\x900;New Window title\x9c")
   59 
   60 
   61 print ( "tab1\ttab2\t\ttab3\t\t\tend")
   62 
   63 # delete until EOL
   64 print ( "Delete:\033[sTEST s - DELETED\n")
   65 print ( "Delete:\033[uTEST u - DELETED\n")
   66 print ( "Delete:\033[KTEST K - DELETED\033[K\033[K\033[K xxx blablabla\n")
   67 print ( "Delete:\033[1KTEST K1 - DELETED\033[K\033[K\033[2K xxx blablabla\n")
   68 
   69 print ( "Delete:\033[0GTEST G - DELETED\033[0G\033[0G\033[0G xxx blablabla\n")
   70 
   71 # but not with grep --color
   72 print ( "\033[01;31m\033[KGREP COLOR SEQUENCE\033[m\033[K 0;\n")
   73 
   74 print ( "1234567890 12345 67890 1234567890 12345 67890 1234567890123456789012345678901234567890123456789012345678901234567890")
   75 print ( "Ignore:\033[=1hEND\n")
   76 print ( "Ignore:\033[?25lEND\n")
   77 print ( "Ignore:\033[0GEND\n")
   78 
   79 #ESC[1GESC[KESC[34m 0:00.60ESC[m^O /usr/bin/gmake -f client.mkESC[m^O
   80 print ( "\0337\0338\0337\0338\0337\0338\n")