neonprint 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.
- neonprint-0.1.0/PKG-INFO +13 -0
- neonprint-0.1.0/README.md +27 -0
- neonprint-0.1.0/neonprint/__init__.py +53 -0
- neonprint-0.1.0/neonprint/core.py +104 -0
- neonprint-0.1.0/neonprint.egg-info/PKG-INFO +13 -0
- neonprint-0.1.0/neonprint.egg-info/SOURCES.txt +9 -0
- neonprint-0.1.0/neonprint.egg-info/dependency_links.txt +1 -0
- neonprint-0.1.0/neonprint.egg-info/requires.txt +1 -0
- neonprint-0.1.0/neonprint.egg-info/top_level.txt +1 -0
- neonprint-0.1.0/setup.cfg +4 -0
- neonprint-0.1.0/setup.py +12 -0
neonprint-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: neonprint
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Chainable colored and styled text printing for Python
|
|
5
|
+
Author: Samarth Chugh
|
|
6
|
+
Keywords: color,terminal,cli,text,style
|
|
7
|
+
Requires-Python: >=3.6
|
|
8
|
+
Requires-Dist: colorama
|
|
9
|
+
Dynamic: author
|
|
10
|
+
Dynamic: keywords
|
|
11
|
+
Dynamic: requires-dist
|
|
12
|
+
Dynamic: requires-python
|
|
13
|
+
Dynamic: summary
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# neonprint
|
|
2
|
+
|
|
3
|
+
A simple and powerful Python library for printing colored and styled text using a clean chaining API.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
pip install neonprint
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
from neonprint import text
|
|
12
|
+
|
|
13
|
+
text("Hello").red().bold().print()
|
|
14
|
+
text("Warning").yellow().bg_red().underline().print()
|
|
15
|
+
text("Rainbow!").rainbow().bold().print()
|
|
16
|
+
|
|
17
|
+
## Features
|
|
18
|
+
|
|
19
|
+
- Chainable API
|
|
20
|
+
- Multiple colors
|
|
21
|
+
- Background colors
|
|
22
|
+
- Bold, underline, reverse
|
|
23
|
+
- Rainbow text 🌈
|
|
24
|
+
|
|
25
|
+
## Example
|
|
26
|
+
|
|
27
|
+
text("Cool").cyan().underline().print()
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
__version__ = "0.1.0"
|
|
2
|
+
|
|
3
|
+
from .core import text
|
|
4
|
+
|
|
5
|
+
# Simple functions
|
|
6
|
+
def red(content):
|
|
7
|
+
text(content).red().print()
|
|
8
|
+
|
|
9
|
+
def green(content):
|
|
10
|
+
text(content).green().print()
|
|
11
|
+
|
|
12
|
+
def yellow(content):
|
|
13
|
+
text(content).yellow().print()
|
|
14
|
+
|
|
15
|
+
def blue(content):
|
|
16
|
+
text(content).blue().print()
|
|
17
|
+
|
|
18
|
+
def magenta(content):
|
|
19
|
+
text(content).magenta().print()
|
|
20
|
+
|
|
21
|
+
def cyan(content):
|
|
22
|
+
text(content).cyan().print()
|
|
23
|
+
|
|
24
|
+
def white(content):
|
|
25
|
+
text(content).white().print()
|
|
26
|
+
|
|
27
|
+
# Styles
|
|
28
|
+
def bold(content):
|
|
29
|
+
text(content).bold().print()
|
|
30
|
+
|
|
31
|
+
def underline(content):
|
|
32
|
+
text(content).underline().print()
|
|
33
|
+
|
|
34
|
+
# Background
|
|
35
|
+
def bg_red(content):
|
|
36
|
+
text(content).bg_red().print()
|
|
37
|
+
|
|
38
|
+
def bg_green(content):
|
|
39
|
+
text(content).bg_green().print()
|
|
40
|
+
|
|
41
|
+
# Rainbow 🌈
|
|
42
|
+
def rainbow(content):
|
|
43
|
+
text(content).rainbow().print()
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
__all__ = [
|
|
48
|
+
"text",
|
|
49
|
+
"red", "green", "yellow", "blue", "magenta", "cyan", "white",
|
|
50
|
+
"bold", "underline",
|
|
51
|
+
"bg_red", "bg_green",
|
|
52
|
+
"rainbow"
|
|
53
|
+
]
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import time
|
|
2
|
+
from colorama import Fore, Back, Style, init
|
|
3
|
+
init(autoreset=True)
|
|
4
|
+
|
|
5
|
+
class StyledText:
|
|
6
|
+
def __init__(self, text):
|
|
7
|
+
self.text = str(text)
|
|
8
|
+
self.styles = []
|
|
9
|
+
|
|
10
|
+
def _add(self, style):
|
|
11
|
+
self.styles.append(style)
|
|
12
|
+
return self
|
|
13
|
+
|
|
14
|
+
# ---------- Text Colors ----------
|
|
15
|
+
def red(self): return self._add(Fore.RED)
|
|
16
|
+
def green(self): return self._add(Fore.GREEN)
|
|
17
|
+
def yellow(self): return self._add(Fore.YELLOW)
|
|
18
|
+
def blue(self): return self._add(Fore.BLUE)
|
|
19
|
+
def magenta(self): return self._add(Fore.MAGENTA)
|
|
20
|
+
def cyan(self): return self._add(Fore.CYAN)
|
|
21
|
+
def white(self): return self._add(Fore.WHITE)
|
|
22
|
+
|
|
23
|
+
# ---------- Background Colors ----------
|
|
24
|
+
def bg_red(self): return self._add(Back.RED)
|
|
25
|
+
def bg_green(self): return self._add(Back.GREEN)
|
|
26
|
+
def bg_yellow(self): return self._add(Back.YELLOW)
|
|
27
|
+
def bg_blue(self): return self._add(Back.BLUE)
|
|
28
|
+
def bg_magenta(self): return self._add(Back.MAGENTA)
|
|
29
|
+
def bg_cyan(self): return self._add(Back.CYAN)
|
|
30
|
+
def bg_white(self): return self._add(Back.WHITE)
|
|
31
|
+
|
|
32
|
+
# ---------- Styles ----------
|
|
33
|
+
def bold(self): return self._add(Style.BRIGHT)
|
|
34
|
+
def dim(self): return self._add(Style.DIM)
|
|
35
|
+
def normal(self): return self._add(Style.NORMAL)
|
|
36
|
+
|
|
37
|
+
def underline(self):
|
|
38
|
+
return self._add('\033[4m')
|
|
39
|
+
|
|
40
|
+
def reverse(self):
|
|
41
|
+
return self._add('\033[7m')
|
|
42
|
+
|
|
43
|
+
# ---------- RGB ----------
|
|
44
|
+
def rgb(self, r, g, b):
|
|
45
|
+
r = max(0, min(255, r))
|
|
46
|
+
g = max(0, min(255, g))
|
|
47
|
+
b = max(0, min(255, b))
|
|
48
|
+
return self._add(f"\033[38;2;{r};{g};{b}m")
|
|
49
|
+
|
|
50
|
+
def bg_rgb(self, r, g, b):
|
|
51
|
+
r = max(0, min(255, r))
|
|
52
|
+
g = max(0, min(255, g))
|
|
53
|
+
b = max(0, min(255, b))
|
|
54
|
+
return self._add(f"\033[48;2;{r};{g};{b}m")
|
|
55
|
+
|
|
56
|
+
# ---------- Rainbow 🌈 ----------
|
|
57
|
+
def rainbow(self):
|
|
58
|
+
colors = [
|
|
59
|
+
Fore.RED, Fore.YELLOW, Fore.GREEN,
|
|
60
|
+
Fore.CYAN, Fore.BLUE, Fore.MAGENTA
|
|
61
|
+
]
|
|
62
|
+
result = ""
|
|
63
|
+
for i, char in enumerate(self.text):
|
|
64
|
+
result += colors[i % len(colors)] + char
|
|
65
|
+
self.text = result
|
|
66
|
+
return self
|
|
67
|
+
|
|
68
|
+
# ---------- Gradient ----------
|
|
69
|
+
def gradient(self, start=(255, 0, 0), end=(0, 0, 255)):
|
|
70
|
+
result = ""
|
|
71
|
+
length = len(self.text)
|
|
72
|
+
|
|
73
|
+
for i, char in enumerate(self.text):
|
|
74
|
+
r = int(start[0] + (end[0] - start[0]) * i / max(length - 1, 1))
|
|
75
|
+
g = int(start[1] + (end[1] - start[1]) * i / max(length - 1, 1))
|
|
76
|
+
b = int(start[2] + (end[2] - start[2]) * i / max(length - 1, 1))
|
|
77
|
+
|
|
78
|
+
result += f"\033[38;2;{r};{g};{b}m{char}"
|
|
79
|
+
|
|
80
|
+
self.text = result
|
|
81
|
+
return self
|
|
82
|
+
|
|
83
|
+
# ---------- Typing Animation ----------
|
|
84
|
+
def type(self, speed=0.05):
|
|
85
|
+
styled = "".join(self.styles)
|
|
86
|
+
for char in self.text:
|
|
87
|
+
print(styled + char + Style.RESET_ALL, end='', flush=True)
|
|
88
|
+
time.sleep(speed)
|
|
89
|
+
print()
|
|
90
|
+
return self
|
|
91
|
+
|
|
92
|
+
# ---------- Output ----------
|
|
93
|
+
def build(self):
|
|
94
|
+
return "".join(self.styles) + self.text + Style.RESET_ALL
|
|
95
|
+
|
|
96
|
+
def print(self):
|
|
97
|
+
print(self.build())
|
|
98
|
+
|
|
99
|
+
def __str__(self):
|
|
100
|
+
return self.build()
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def text(content):
|
|
104
|
+
return StyledText(content)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: neonprint
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Chainable colored and styled text printing for Python
|
|
5
|
+
Author: Samarth Chugh
|
|
6
|
+
Keywords: color,terminal,cli,text,style
|
|
7
|
+
Requires-Python: >=3.6
|
|
8
|
+
Requires-Dist: colorama
|
|
9
|
+
Dynamic: author
|
|
10
|
+
Dynamic: keywords
|
|
11
|
+
Dynamic: requires-dist
|
|
12
|
+
Dynamic: requires-python
|
|
13
|
+
Dynamic: summary
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
colorama
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
neonprint
|
neonprint-0.1.0/setup.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name="neonprint",
|
|
5
|
+
version="0.1.0",
|
|
6
|
+
packages=find_packages(),
|
|
7
|
+
description="Chainable colored and styled text printing for Python",
|
|
8
|
+
author="Samarth Chugh",
|
|
9
|
+
install_requires=["colorama"],
|
|
10
|
+
python_requires=">=3.6",
|
|
11
|
+
keywords=["color", "terminal", "cli", "text", "style"],
|
|
12
|
+
)
|