File: ansi_colors.py

package info (click to toggle)
python-tcolorpy 0.1.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 468 kB
  • sloc: python: 624; makefile: 53; sh: 6
file content (32 lines) | stat: -rwxr-xr-x 737 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env python3

import sys

from tcolorpy import AnsiBGColor, AnsiFGColor, tcolor


def main() -> int:
    template = "{:26} {:26} {:26}"

    print(
        template.format(
            tcolor("color", color="white"),
            tcolor("bg_color", color="white"),
            tcolor("invert", color="white"),
        )
    )
    print("━" * 50)
    for fg_color, bg_color in zip(AnsiFGColor, AnsiBGColor):
        print(
            template.format(
                tcolor(fg_color.name, color=fg_color),
                tcolor(bg_color.name, bg_color=bg_color),
                tcolor(fg_color.name, color=fg_color, styles=["invert"]),
            )
        )

    return 0


if __name__ == "__main__":
    sys.exit(main())