File: test_cprint.py

package info (click to toggle)
colored 2.2.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 240 kB
  • sloc: python: 2,064; makefile: 4
file content (33 lines) | stat: -rw-r--r-- 984 bytes parent folder | download
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
33
#!/usr/bin/env python
# -*- coding: utf-8 -*-

""" Test cprint(text: str,
           fore_256: int | str = '',
           back_256: int | str = '',
           fore_rgb: tuple = (255, 255, 255),
           back_rgb: tuple = (0, 0, 0),
           formatting: int | str = '',
           line_color: int | str = '',
           reset=True,
           **kwargs) function.
"""

import random
from colored.library import Library
from colored.cprint import cprint


def main():

    for color in Library.COLORS.values():
        back: int = random.randint(0, 255)
        a: int = random.randint(0, 255)
        b: int = random.randint(0, 255)
        c: int = random.randint(0, 255)
        style: str = random.choice(list(Library.STYLES.values()))
        cprint(' Hello World or World Hello? ', fore_256=color, back_256=back, formatting=style)
        cprint(' Hello World or World Hello? ', fore_rgb=(a, b, c), back_rgb=(c, b, a), formatting=style)


if __name__ == '__main__':
    main()