• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

CHANGES.rstH A D13-Jan-2011577 4126

PKG-INFOH A D13-Jan-20113.9 KiB134101

README.rstH A D13-Jan-20111.9 KiB7357

setup.pyH A D13-Jan-20112.1 KiB5626

termcolor.pyH A D13-Jan-20114.9 KiB169115

README.rst

1Example
2=======
3    ::
4
5        import sys
6        from termcolor import colored, cprint
7
8        text = colored('Hello, World!', 'red', attrs=['reverse', 'blink'])
9        print(text)
10        cprint('Hello, World!', 'green', 'on_red')
11
12        print_red_on_cyan = lambda x: cprint(x, 'red', 'on_cyan')
13        print_red_on_cyan('Hello, World!')
14        print_red_on_cyan('Hello, Universe!')
15
16        for i in range(10):
17            cprint(i, 'magenta', end=' ')
18
19        cprint("Attention!", 'red', attrs=['bold'], file=sys.stderr)
20
21Text Properties
22===============
23
24  Text colors:
25
26      - grey
27      - red
28      - green
29      - yellow
30      - blue
31      - magenta
32      - cyan
33      - white
34
35  Text highlights:
36
37      - on_grey
38      - on_red
39      - on_green
40      - on_yellow
41      - on_blue
42      - on_magenta
43      - on_cyan
44      - on_white
45
46  Attributes:
47
48      - bold
49      - dark
50      - underline
51      - blink
52      - reverse
53      - concealed
54
55Terminal properties
56===================
57
58    ============ ======= ==== ========= ========== ======= =========
59    Terminal     bold    dark underline blink      reverse concealed
60    ------------ ------- ---- --------- ---------- ------- ---------
61    xterm        yes     no   yes       bold       yes     yes
62    linux        yes     yes  bold      yes        yes     no
63    rxvt         yes     no   yes       bold/black yes     no
64    dtterm       yes     yes  yes       reverse    yes     yes
65    teraterm     reverse no   yes       rev/red    yes     no
66    aixterm      normal  no   yes       no         yes     yes
67    PuTTY        color   no   yes       no         yes     no
68    Windows      no      no   no        no         yes     no
69    Cygwin SSH   yes     no   color     color      color   yes
70    Mac Terminal yes     no   yes       yes        yes     yes
71    ============ ======= ==== ========= ========== ======= =========
72
73