trgb 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
trgb-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,67 @@
1
+ Metadata-Version: 2.4
2
+ Name: trgb
3
+ Version: 0.1.0
4
+ Summary: Library for Python with colors, styles, support rgb and 256 colors for terminal
5
+ Author: 13
6
+ License: MIT
7
+ Keywords: ansi,terminal,colors,rgb
8
+ Classifier: Intended Audience :: Developers
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Requires-Python: >=3.10
13
+ Description-Content-Type: text/markdown
14
+
15
+ # TerminalRGB - trgb
16
+
17
+ A library for styling text in a terminal using ANSI-codes for Python
18
+
19
+ -------------------------
20
+
21
+ Functional:
22
+
23
+ Colors, Styles, RGB and 256 palette
24
+
25
+ import:
26
+
27
+ '''bash
28
+
29
+ pip install tcx
30
+
31
+ '''py
32
+
33
+ from tcx import red, blue, bold, rgb ...
34
+
35
+ using:
36
+
37
+ '''py
38
+
39
+ print(red("Print red text"))
40
+
41
+ --------------------------- or
42
+
43
+ style = red("Print red text")
44
+ print(red)
45
+
46
+ the ability to stack styles:
47
+
48
+ ## WARNING: the interpreter may consider your action to be an error - use type ignore
49
+
50
+ '''py
51
+
52
+ print(bold + rgb(1,1,1)("Hello World!"))
53
+
54
+ --------------------------- or
55
+
56
+ style = bold + rgb(4, 239, 8)
57
+ print(style("Hello World!"))
58
+
59
+
60
+ you can stack as many styles as you want:
61
+
62
+ '''py
63
+
64
+ style = bg_rgb(1,1,1) + rgb(2,2,2) + italic
65
+ print(style("text"))
66
+
67
+ # I wish you a pleasant experience. Good luck!
trgb-0.1.0/README.md ADDED
@@ -0,0 +1,53 @@
1
+ # TerminalRGB - trgb
2
+
3
+ A library for styling text in a terminal using ANSI-codes for Python
4
+
5
+ -------------------------
6
+
7
+ Functional:
8
+
9
+ Colors, Styles, RGB and 256 palette
10
+
11
+ import:
12
+
13
+ '''bash
14
+
15
+ pip install tcx
16
+
17
+ '''py
18
+
19
+ from tcx import red, blue, bold, rgb ...
20
+
21
+ using:
22
+
23
+ '''py
24
+
25
+ print(red("Print red text"))
26
+
27
+ --------------------------- or
28
+
29
+ style = red("Print red text")
30
+ print(red)
31
+
32
+ the ability to stack styles:
33
+
34
+ ## WARNING: the interpreter may consider your action to be an error - use type ignore
35
+
36
+ '''py
37
+
38
+ print(bold + rgb(1,1,1)("Hello World!"))
39
+
40
+ --------------------------- or
41
+
42
+ style = bold + rgb(4, 239, 8)
43
+ print(style("Hello World!"))
44
+
45
+
46
+ you can stack as many styles as you want:
47
+
48
+ '''py
49
+
50
+ style = bg_rgb(1,1,1) + rgb(2,2,2) + italic
51
+ print(style("text"))
52
+
53
+ # I wish you a pleasant experience. Good luck!
@@ -0,0 +1,29 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68","wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "trgb"
7
+ version = "0.1.0"
8
+ description = "Library for Python with colors, styles, support rgb and 256 colors for terminal"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = { text = "MIT" }
12
+ authors = [
13
+ { name = "13" }
14
+ ]
15
+ keywords = [ "ansi", "terminal", "colors", "rgb" ]
16
+
17
+ classifiers = [
18
+ "Intended Audience :: Developers",
19
+ "Programming Language :: Python :: 3",
20
+ "License :: OSI Approved :: MIT License",
21
+ "Operating System :: OS Independent"
22
+ ]
23
+
24
+
25
+ [tool.setuptools]
26
+ package-dir = { "" = "src" }
27
+
28
+ [tool.setuptools.packages.find]
29
+ where = ["src"]
trgb-0.1.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,8 @@
1
+ from .colors import red, green, yellow, black, blue, magenta, cyan, white, gray, bright_blue, bright_cyan, bright_green, bright_magenta, bright_red, bright_white, bright_yellow, bg_black, bg_blue, bg_cyan, bg_gray, bg_green, bg_magenta, bg_red, bg_white, bg_yellow, bright_bg_magenta, bright_bg_blue, bright_bg_cyan, bright_bg_green, bright_bg_red, bright_bg_white, bright_bg_yellow
2
+ from .styles import bold, dim, italic, underline, blink, blink_fast, reverse, hidden,strikethrough
3
+ from .colors256 import custom_color, custom_bg
4
+ from .rgb import rgb, bg_rgb
5
+
6
+ __all__ = [
7
+ 'red','green', 'yellow', 'black', 'blue', 'magenta', 'cyan', 'white', 'gray', 'bright_blue', 'bright_cyan', 'bright_green', 'bright_magenta', 'bright_red', 'bright_white', 'bright_yellow', 'bg_black', 'bg_blue', 'bg_cyan', 'bg_gray', 'bg_green', 'bg_magenta', 'bg_red', 'bg_white', 'bg_yellow', 'bright_bg_magenta', 'bright_bg_blue', 'bright_bg_cyan', 'bright_bg_green', 'bright_bg_red', 'bright_bg_white', 'bright_bg_yellow', 'bold', 'dim', 'italic', 'underline', 'blink', 'blink_fast', 'reverse', 'hidden', 'strikethrough', 'custom_color', 'custom_bg', 'rgb', 'bg_rgb'
8
+ ]
@@ -0,0 +1,45 @@
1
+ from main import SW
2
+
3
+ class Colors(SW):
4
+ def __init__(self, *code: str):
5
+ super().__init__(*code)
6
+
7
+ red = Colors('31')
8
+ green = Colors('32')
9
+ yellow = Colors('33')
10
+ blue = Colors('34')
11
+ magenta = Colors('35')
12
+ cyan = Colors('36')
13
+ white = Colors('37')
14
+ black = Colors('30')
15
+ gray = Colors('90')
16
+
17
+ bright_red = Colors('91')
18
+ bright_green = Colors('92')
19
+ bright_yellow = Colors('93')
20
+ bright_blue = Colors('94')
21
+ bright_magenta = Colors('95')
22
+ bright_cyan = Colors('96')
23
+ bright_white = Colors('97')
24
+
25
+ class BgColors(SW):
26
+ def __init__(self, *code: str):
27
+ super().__init__(*code)
28
+
29
+ bg_red = BgColors('41')
30
+ bg_black = BgColors('40')
31
+ bg_green = BgColors('42')
32
+ bg_yellow = BgColors('43')
33
+ bg_blue = BgColors('44')
34
+ bg_magenta = BgColors('45')
35
+ bg_cyan = BgColors('46')
36
+ bg_white = BgColors('47')
37
+ bg_gray = BgColors('100')
38
+
39
+ bright_bg_red = BgColors('101')
40
+ bright_bg_green = BgColors('102')
41
+ bright_bg_yellow = BgColors('103')
42
+ bright_bg_blue = BgColors('104')
43
+ bright_bg_magenta = BgColors('105')
44
+ bright_bg_cyan = BgColors('106')
45
+ bright_bg_white = BgColors('107')
@@ -0,0 +1,19 @@
1
+ from main import SW
2
+
3
+ class Colors256(SW):
4
+ def __init__(self, color):
5
+ if not 0 <= color <= 255:
6
+ raise ValueError("Color mode must be range 0 ... 256")
7
+ super().__init__(f"38;5;{color}")
8
+
9
+ def custom_color(color: int):
10
+ return Colors256(color)
11
+
12
+ class BgColors256(SW):
13
+ def __init__(self, color):
14
+ if not 0 <= color <= 255:
15
+ raise ValueError("Color mode must be range 0 ... 256")
16
+ super().__init__(f"48;5;{color}")
17
+
18
+ def custom_bg(color: int):
19
+ return BgColors256(color)
@@ -0,0 +1,22 @@
1
+ class SW:
2
+ RESET = "\033[0m"
3
+
4
+ def __init__(self, *code: str):
5
+ self.code = tuple(code)
6
+
7
+ def __add__(self, other):
8
+ if hasattr(other, "code"):
9
+ return SW(*(self.code + other.code))
10
+ return NotImplemented
11
+
12
+ def __radd__(self, other):
13
+ if hasattr(other, "code"):
14
+ return SW(*(other.code + self.code))
15
+ return NotImplemented
16
+
17
+ def __call__(self, *args, sep='', reset=True):
18
+ text = sep.join(map(str, args))
19
+ codes = ";".join(self.code)
20
+ prefix = f"\033[{codes}m"
21
+ suf = self.RESET if reset else ''
22
+ return f"{prefix}{text}{suf}"
@@ -0,0 +1,21 @@
1
+ from main import SW
2
+
3
+ class RGBColors(SW):
4
+ def __init__(self, r: int, g: int, b: int):
5
+ for c in (r, g, b):
6
+ if not 0 <= c <= 255:
7
+ raise ValueError("Values can must be in range 0 ... 255")
8
+ super().__init__(f"38;2;{r};{g};{b}")
9
+
10
+ def rgb(r: int, g: int, b: int):
11
+ return RGBColors(r, g, b)
12
+
13
+ class BgRGBColors(SW):
14
+ def __init__(self, r: int, g: int, b: int):
15
+ for c in (r, g, b):
16
+ if not 0 <= c <= 255:
17
+ raise ValueError("Values can must be in range 0 ... 255")
18
+ super().__init__(f"48;2;{r};{g};{b}")
19
+
20
+ def bg_rgb(r: int, g: int, b: int):
21
+ return BgRGBColors(r, g, b)
@@ -0,0 +1,15 @@
1
+ from main import SW
2
+
3
+ class Styles(SW):
4
+ def __init__(self, *code: str):
5
+ super().__init__(*code)
6
+
7
+ bold = Styles('1')
8
+ dim = Styles('2')
9
+ italic = Styles('3')
10
+ underline = Styles('4')
11
+ blink = Styles('5')
12
+ blink_fast = Styles('6')
13
+ reverse = Styles('7')
14
+ hidden = Styles('8')
15
+ strikethrough = Styles('9')
@@ -0,0 +1,67 @@
1
+ Metadata-Version: 2.4
2
+ Name: trgb
3
+ Version: 0.1.0
4
+ Summary: Library for Python with colors, styles, support rgb and 256 colors for terminal
5
+ Author: 13
6
+ License: MIT
7
+ Keywords: ansi,terminal,colors,rgb
8
+ Classifier: Intended Audience :: Developers
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Requires-Python: >=3.10
13
+ Description-Content-Type: text/markdown
14
+
15
+ # TerminalRGB - trgb
16
+
17
+ A library for styling text in a terminal using ANSI-codes for Python
18
+
19
+ -------------------------
20
+
21
+ Functional:
22
+
23
+ Colors, Styles, RGB and 256 palette
24
+
25
+ import:
26
+
27
+ '''bash
28
+
29
+ pip install tcx
30
+
31
+ '''py
32
+
33
+ from tcx import red, blue, bold, rgb ...
34
+
35
+ using:
36
+
37
+ '''py
38
+
39
+ print(red("Print red text"))
40
+
41
+ --------------------------- or
42
+
43
+ style = red("Print red text")
44
+ print(red)
45
+
46
+ the ability to stack styles:
47
+
48
+ ## WARNING: the interpreter may consider your action to be an error - use type ignore
49
+
50
+ '''py
51
+
52
+ print(bold + rgb(1,1,1)("Hello World!"))
53
+
54
+ --------------------------- or
55
+
56
+ style = bold + rgb(4, 239, 8)
57
+ print(style("Hello World!"))
58
+
59
+
60
+ you can stack as many styles as you want:
61
+
62
+ '''py
63
+
64
+ style = bg_rgb(1,1,1) + rgb(2,2,2) + italic
65
+ print(style("text"))
66
+
67
+ # I wish you a pleasant experience. Good luck!
@@ -0,0 +1,12 @@
1
+ README.md
2
+ pyproject.toml
3
+ src/tcx/__init__.py
4
+ src/tcx/colors.py
5
+ src/tcx/colors256.py
6
+ src/tcx/main.py
7
+ src/tcx/rgb.py
8
+ src/tcx/styles.py
9
+ src/trgb.egg-info/PKG-INFO
10
+ src/trgb.egg-info/SOURCES.txt
11
+ src/trgb.egg-info/dependency_links.txt
12
+ src/trgb.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ tcx