rich-gradient 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.
Files changed (133) hide show
  1. rich_gradient-0.1.0/.gitignore +11 -0
  2. rich_gradient-0.1.0/.python-version +1 -0
  3. rich_gradient-0.1.0/.readthedocs.yaml +14 -0
  4. rich_gradient-0.1.0/.vscode/launch.json +16 -0
  5. rich_gradient-0.1.0/.vscode/rich-gradient.code-workspace +220 -0
  6. rich_gradient-0.1.0/.vscode/settings.json +18 -0
  7. rich_gradient-0.1.0/PKG-INFO +138 -0
  8. rich_gradient-0.1.0/README.md +122 -0
  9. rich_gradient-0.1.0/cspell.json +9 -0
  10. rich_gradient-0.1.0/docs/CHANGELOG.md +10 -0
  11. rich_gradient-0.1.0/docs/color.md +11 -0
  12. rich_gradient-0.1.0/docs/color_ref.md +13 -0
  13. rich_gradient-0.1.0/docs/gradient.md +36 -0
  14. rich_gradient-0.1.0/docs/gradient_ref.md +13 -0
  15. rich_gradient-0.1.0/docs/gradient_rule.md +54 -0
  16. rich_gradient-0.1.0/docs/gradient_rule_ref.md +13 -0
  17. rich_gradient-0.1.0/docs/img/MaxLogo.svg +64 -0
  18. rich_gradient-0.1.0/docs/img/color_formats.svg +154 -0
  19. rich_gradient-0.1.0/docs/img/colors.svg +1733 -0
  20. rich_gradient-0.1.0/docs/img/example_rainbow_gradient.svg +93 -0
  21. rich_gradient-0.1.0/docs/img/gradient.svg +179 -0
  22. rich_gradient-0.1.0/docs/img/hello_world.svg +79 -0
  23. rich_gradient-0.1.0/docs/img/named_gradient_example.svg +151 -0
  24. rich_gradient-0.1.0/docs/img/rainbow_gradient_example.svg +142 -0
  25. rich_gradient-0.1.0/docs/img/random_gradient_example.svg +136 -0
  26. rich_gradient-0.1.0/docs/img/rich-gradient-icon.svg +113 -0
  27. rich_gradient-0.1.0/docs/img/rich-gradient.svg +124 -0
  28. rich_gradient-0.1.0/docs/img/rule_example.svg +262 -0
  29. rich_gradient-0.1.0/docs/img/rule_example1.svg +116 -0
  30. rich_gradient-0.1.0/docs/img/rule_example2.svg +104 -0
  31. rich_gradient-0.1.0/docs/img/rule_example3.svg +98 -0
  32. rich_gradient-0.1.0/docs/img/simple_gradient.svg +215 -0
  33. rich_gradient-0.1.0/docs/img/specific_color_gradient.svg +118 -0
  34. rich_gradient-0.1.0/docs/img/spectrum.svg +58 -0
  35. rich_gradient-0.1.0/docs/img/still_text.svg +144 -0
  36. rich_gradient-0.1.0/docs/index.md +124 -0
  37. rich_gradient-0.1.0/docs/styles/extra.css +216 -0
  38. rich_gradient-0.1.0/docs/styles/style.css +1119 -0
  39. rich_gradient-0.1.0/mkdocs.yml +82 -0
  40. rich_gradient-0.1.0/pyproject.toml +33 -0
  41. rich_gradient-0.1.0/requirements-dev.lock +119 -0
  42. rich_gradient-0.1.0/requirements.lock +119 -0
  43. rich_gradient-0.1.0/site/404.html +568 -0
  44. rich_gradient-0.1.0/site/CHANGELOG/index.html +647 -0
  45. rich_gradient-0.1.0/site/assets/_mkdocstrings.css +119 -0
  46. rich_gradient-0.1.0/site/assets/images/favicon.png +0 -0
  47. rich_gradient-0.1.0/site/assets/javascripts/bundle.ad660dcc.min.js +29 -0
  48. rich_gradient-0.1.0/site/assets/javascripts/bundle.ad660dcc.min.js.map +7 -0
  49. rich_gradient-0.1.0/site/assets/javascripts/lunr/min/lunr.ar.min.js +1 -0
  50. rich_gradient-0.1.0/site/assets/javascripts/lunr/min/lunr.da.min.js +18 -0
  51. rich_gradient-0.1.0/site/assets/javascripts/lunr/min/lunr.de.min.js +18 -0
  52. rich_gradient-0.1.0/site/assets/javascripts/lunr/min/lunr.du.min.js +18 -0
  53. rich_gradient-0.1.0/site/assets/javascripts/lunr/min/lunr.el.min.js +1 -0
  54. rich_gradient-0.1.0/site/assets/javascripts/lunr/min/lunr.es.min.js +18 -0
  55. rich_gradient-0.1.0/site/assets/javascripts/lunr/min/lunr.fi.min.js +18 -0
  56. rich_gradient-0.1.0/site/assets/javascripts/lunr/min/lunr.fr.min.js +18 -0
  57. rich_gradient-0.1.0/site/assets/javascripts/lunr/min/lunr.he.min.js +1 -0
  58. rich_gradient-0.1.0/site/assets/javascripts/lunr/min/lunr.hi.min.js +1 -0
  59. rich_gradient-0.1.0/site/assets/javascripts/lunr/min/lunr.hu.min.js +18 -0
  60. rich_gradient-0.1.0/site/assets/javascripts/lunr/min/lunr.hy.min.js +1 -0
  61. rich_gradient-0.1.0/site/assets/javascripts/lunr/min/lunr.it.min.js +18 -0
  62. rich_gradient-0.1.0/site/assets/javascripts/lunr/min/lunr.ja.min.js +1 -0
  63. rich_gradient-0.1.0/site/assets/javascripts/lunr/min/lunr.jp.min.js +1 -0
  64. rich_gradient-0.1.0/site/assets/javascripts/lunr/min/lunr.kn.min.js +1 -0
  65. rich_gradient-0.1.0/site/assets/javascripts/lunr/min/lunr.ko.min.js +1 -0
  66. rich_gradient-0.1.0/site/assets/javascripts/lunr/min/lunr.multi.min.js +1 -0
  67. rich_gradient-0.1.0/site/assets/javascripts/lunr/min/lunr.nl.min.js +18 -0
  68. rich_gradient-0.1.0/site/assets/javascripts/lunr/min/lunr.no.min.js +18 -0
  69. rich_gradient-0.1.0/site/assets/javascripts/lunr/min/lunr.pt.min.js +18 -0
  70. rich_gradient-0.1.0/site/assets/javascripts/lunr/min/lunr.ro.min.js +18 -0
  71. rich_gradient-0.1.0/site/assets/javascripts/lunr/min/lunr.ru.min.js +18 -0
  72. rich_gradient-0.1.0/site/assets/javascripts/lunr/min/lunr.sa.min.js +1 -0
  73. rich_gradient-0.1.0/site/assets/javascripts/lunr/min/lunr.stemmer.support.min.js +1 -0
  74. rich_gradient-0.1.0/site/assets/javascripts/lunr/min/lunr.sv.min.js +18 -0
  75. rich_gradient-0.1.0/site/assets/javascripts/lunr/min/lunr.ta.min.js +1 -0
  76. rich_gradient-0.1.0/site/assets/javascripts/lunr/min/lunr.te.min.js +1 -0
  77. rich_gradient-0.1.0/site/assets/javascripts/lunr/min/lunr.th.min.js +1 -0
  78. rich_gradient-0.1.0/site/assets/javascripts/lunr/min/lunr.tr.min.js +18 -0
  79. rich_gradient-0.1.0/site/assets/javascripts/lunr/min/lunr.vi.min.js +1 -0
  80. rich_gradient-0.1.0/site/assets/javascripts/lunr/min/lunr.zh.min.js +1 -0
  81. rich_gradient-0.1.0/site/assets/javascripts/lunr/tinyseg.js +206 -0
  82. rich_gradient-0.1.0/site/assets/javascripts/lunr/wordcut.js +6708 -0
  83. rich_gradient-0.1.0/site/assets/javascripts/workers/search.b8dbb3d2.min.js +42 -0
  84. rich_gradient-0.1.0/site/assets/javascripts/workers/search.b8dbb3d2.min.js.map +7 -0
  85. rich_gradient-0.1.0/site/assets/stylesheets/main.6543a935.min.css +1 -0
  86. rich_gradient-0.1.0/site/assets/stylesheets/main.6543a935.min.css.map +1 -0
  87. rich_gradient-0.1.0/site/assets/stylesheets/palette.06af60db.min.css +1 -0
  88. rich_gradient-0.1.0/site/assets/stylesheets/palette.06af60db.min.css.map +1 -0
  89. rich_gradient-0.1.0/site/color/index.html +616 -0
  90. rich_gradient-0.1.0/site/color_ref/index.html +4767 -0
  91. rich_gradient-0.1.0/site/gradient/index.html +679 -0
  92. rich_gradient-0.1.0/site/gradient_ref/index.html +3823 -0
  93. rich_gradient-0.1.0/site/gradient_rule/index.html +698 -0
  94. rich_gradient-0.1.0/site/gradient_rule_ref/index.html +2636 -0
  95. rich_gradient-0.1.0/site/img/MaxLogo.svg +64 -0
  96. rich_gradient-0.1.0/site/img/color_formats.svg +154 -0
  97. rich_gradient-0.1.0/site/img/colors.svg +1733 -0
  98. rich_gradient-0.1.0/site/img/example_rainbow_gradient.svg +93 -0
  99. rich_gradient-0.1.0/site/img/gradient.svg +179 -0
  100. rich_gradient-0.1.0/site/img/hello_world.svg +79 -0
  101. rich_gradient-0.1.0/site/img/named_gradient_example.svg +151 -0
  102. rich_gradient-0.1.0/site/img/rainbow_gradient_example.svg +142 -0
  103. rich_gradient-0.1.0/site/img/random_gradient_example.svg +136 -0
  104. rich_gradient-0.1.0/site/img/rich-gradient-icon.svg +113 -0
  105. rich_gradient-0.1.0/site/img/rich-gradient.svg +124 -0
  106. rich_gradient-0.1.0/site/img/rule_example.svg +262 -0
  107. rich_gradient-0.1.0/site/img/rule_example1.svg +116 -0
  108. rich_gradient-0.1.0/site/img/rule_example2.svg +104 -0
  109. rich_gradient-0.1.0/site/img/rule_example3.svg +98 -0
  110. rich_gradient-0.1.0/site/img/simple_gradient.svg +215 -0
  111. rich_gradient-0.1.0/site/img/specific_color_gradient.svg +118 -0
  112. rich_gradient-0.1.0/site/img/spectrum.svg +58 -0
  113. rich_gradient-0.1.0/site/img/still_text.svg +144 -0
  114. rich_gradient-0.1.0/site/index.html +834 -0
  115. rich_gradient-0.1.0/site/objects.inv +0 -0
  116. rich_gradient-0.1.0/site/search/search_index.json +1 -0
  117. rich_gradient-0.1.0/site/sitemap.xml +3 -0
  118. rich_gradient-0.1.0/site/sitemap.xml.gz +0 -0
  119. rich_gradient-0.1.0/site/styles/extra.css +216 -0
  120. rich_gradient-0.1.0/site/styles/style.css +1119 -0
  121. rich_gradient-0.1.0/src/rich_gradient/__init__.py +18 -0
  122. rich_gradient-0.1.0/src/rich_gradient/_simple_gradient.py +315 -0
  123. rich_gradient-0.1.0/src/rich_gradient/color.py +875 -0
  124. rich_gradient-0.1.0/src/rich_gradient/default_styles.py +778 -0
  125. rich_gradient-0.1.0/src/rich_gradient/examples/__init__.py +0 -0
  126. rich_gradient-0.1.0/src/rich_gradient/examples/example_gradient.py +180 -0
  127. rich_gradient-0.1.0/src/rich_gradient/examples/example_rule.py +62 -0
  128. rich_gradient-0.1.0/src/rich_gradient/examples/py.typed +0 -0
  129. rich_gradient-0.1.0/src/rich_gradient/gradient.py +593 -0
  130. rich_gradient-0.1.0/src/rich_gradient/py.typed +0 -0
  131. rich_gradient-0.1.0/src/rich_gradient/rule.py +374 -0
  132. rich_gradient-0.1.0/src/rich_gradient/spectrum.py +162 -0
  133. rich_gradient-0.1.0/src/rich_gradient/theme.py +102 -0
@@ -0,0 +1,11 @@
1
+ # python generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+
9
+ # venv
10
+ .venv
11
+ docs/img/.DS_Store
@@ -0,0 +1 @@
1
+ 3.12.3
@@ -0,0 +1,14 @@
1
+ # Read the Docs configuration file for MkDocs projects
2
+ # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3
+
4
+ # Required
5
+ version: 2
6
+
7
+ # Set the version of Python and other tools you might need
8
+ build:
9
+ os: ubuntu-22.04
10
+ tools:
11
+ python: "3.10"
12
+
13
+ mkdocs:
14
+ configuration: mkdocs.yml
@@ -0,0 +1,16 @@
1
+ {
2
+ // Use IntelliSense to learn about possible attributes.
3
+ // Hover to view descriptions of existing attributes.
4
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
+ "version": "0.2.0",
6
+ "configurations": [
7
+
8
+ {
9
+ "name": "Python Debugger: Current File",
10
+ "type": "debugpy",
11
+ "request": "launch",
12
+ "program": "${file}",
13
+ "console": "integratedTerminal"
14
+ }
15
+ ]
16
+ }
@@ -0,0 +1,220 @@
1
+ {
2
+ "folders": [
3
+ {
4
+ "path": ".."
5
+ }
6
+ ],
7
+ "settings": {
8
+ "editor.semanticTokenColorCustomizations": {
9
+ "enabled": true,
10
+ "rules": {
11
+ "variable": {
12
+ "foreground": "#55AAFF"
13
+ },
14
+ "function": {
15
+ "foreground": "#99ff00"
16
+ },
17
+ "parameter": {
18
+ "foreground": "#00afFF"
19
+ },
20
+ "property": {
21
+ "foreground": "#FF0099"
22
+ },
23
+ "enumMember": {
24
+ "foreground": "#FFFF00"
25
+ },
26
+ "enum": {
27
+ "foreground": "#0099FF"
28
+ },
29
+ "keyword": {
30
+ "foreground": "#9900ff"
31
+ },
32
+ "operator": {
33
+ "foreground": "#00FF00"
34
+ },
35
+ "comment": {
36
+ "foreground": "#3f3e86"
37
+ },
38
+ "number": {
39
+ "foreground": "#FFFF00"
40
+ },
41
+ "regexp": {
42
+ "foreground": "#00FFFF"
43
+ },
44
+ "type": {
45
+ "foreground": "#afff00"
46
+ },
47
+ "namespace": {
48
+ "foreground": "#00FF99"
49
+ },
50
+ "interface": {
51
+ "foreground": "#0000FF"
52
+ },
53
+ "struct": {
54
+ "foreground": "#9999FF"
55
+ },
56
+ "class": {
57
+ "foreground": "#999FFF"
58
+ },
59
+ "functionVariable": {
60
+ "foreground": "#7f44b7"
61
+ },
62
+ "constant": {
63
+ "foreground": "#afff00"
64
+ },
65
+ "string": {
66
+ "foreground": "#e5da95"
67
+ }
68
+ }
69
+ },
70
+ "files.associations": {
71
+ "*.yaml": "home-assistant"
72
+ },
73
+ "sqltools.connections": [
74
+ {
75
+ "name": "supergene",
76
+ "driver": "sqlite",
77
+ "server": "localhost",
78
+ "database": "/Users/maxludden/dev/py/supergene/db/supergene.db",
79
+ "username": "",
80
+ "password": "",
81
+ "port": 0,
82
+ "multipleStatements": true,
83
+ "ssl": false,
84
+ "isGlobal": true
85
+ },
86
+ {
87
+ "previewLimit": 50,
88
+ "driver": "SQLite",
89
+ "name": "supergene.db",
90
+ "database": "/Users/maxludden/dev/py/supergene/supergene.db"
91
+ }
92
+ ]
93
+ },
94
+ "editor.tokenColorCustomizations": {
95
+ "textMateRules": [
96
+ {
97
+ "scope": "string.quoted.double.json meta.structure.dictionary.json string.quoted.double.json jsonc.comments",
98
+ "settings": {
99
+ "foreground": "#ffffcc"
100
+ }
101
+ },
102
+ {
103
+ "scope": "meta.key.json",
104
+ "settings": {
105
+ "foreground": "#ccffcc"
106
+ }
107
+ },
108
+ {
109
+ "scope": "support.type.property-name.json.comments",
110
+ "settings": {
111
+ "foreground": "#ffffff"
112
+ }
113
+ },
114
+ {
115
+ "scope": "string.json.comments",
116
+ "settings": {
117
+ "foreground": "#6771f8"
118
+ }
119
+ },
120
+ {
121
+ "scope": "meta.structure.dictionary.jvalue.json.comments",
122
+ "settings": {
123
+ "foreground": "#636497"
124
+ }
125
+ },
126
+ {
127
+ "scope": "meta.structure.dictionary.json.comments",
128
+ "settings": {
129
+ "foreground": "#74f194"
130
+ }
131
+ },
132
+ {
133
+ "scope": "meta.structure.dictionary.json.comments",
134
+ "settings": {
135
+ "foreground": "#abc6c0"
136
+ }
137
+ },
138
+ {
139
+ "scope": "source.json.comments",
140
+ "settings": {
141
+ "foreground": "#abc6c0"
142
+ }
143
+ },
144
+ {
145
+ "scope": "punctuation.support.type.property-name.begin",
146
+ "settings": {
147
+ "foreground": "#9ebdff"
148
+ }
149
+ },
150
+ {
151
+ "scope": "punctuation.support.type.property-name.end",
152
+ "settings": {
153
+ "foreground": "#9ebdff"
154
+ }
155
+ },
156
+ {
157
+ "scope": "constant.language",
158
+ "settings": {
159
+ "foreground": "#afff00"
160
+ }
161
+ },
162
+ {
163
+ "name": "Fstring Varialbe",
164
+ "scope": "constant.character.format.placeholder.other.python",
165
+ "settings": {
166
+ "foreground": "#ff00ff"
167
+ }
168
+ },
169
+ {
170
+ "scope": "meta.structure.dictionary.json.comments",
171
+ "settings": {
172
+ "foreground": "#74f194"
173
+ }
174
+ },
175
+ {
176
+ "scope": "meta.structure.dictionary.value.json.comments",
177
+ "settings": {
178
+ "foreground": "#9d4edd"
179
+ }
180
+ },
181
+ {
182
+ "scope": "source.json.comments",
183
+ "settings": {
184
+ "foreground": "#abc6c0"
185
+ }
186
+ },
187
+ {
188
+ "scope": "punctuation.support.type.property-name.begin",
189
+ "settings": {
190
+ "foreground": "#9ebdff"
191
+ }
192
+ },
193
+ {
194
+ "scope": "punctuation.support.type.property-name.end",
195
+ "settings": {
196
+ "foreground": "#9ebdff"
197
+ }
198
+ },
199
+ {
200
+ "scope": "constant.language",
201
+ "settings": {
202
+ "foreground": "#afff00"
203
+ }
204
+ },
205
+ {
206
+ "name": "F-string Varialbe",
207
+ "scope": "constant.character.format.placeholder.other.python",
208
+ "settings": {
209
+ "foreground": "#ff00ff"
210
+ }
211
+ }
212
+ ],
213
+ },
214
+ "workbench.colorCustomizations": {
215
+ "gitDecoration.modifiedResourceForeground": "#ff00ff",
216
+ "gitDecoration.deletedResourceForeground": "#ff0000",
217
+ "gitDecoration.untrackedResourceForeground": "#00ff00",
218
+ "sidebar.background": "#000000",
219
+ }
220
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "search.useIgnoreFiles": false,
3
+ "files.exclude": {
4
+ "**/.git": false,
5
+ "**/.svn": false,
6
+ "**/CVS": false
7
+ },
8
+ "python.analysis.diagnosticSeverityOverrides": {
9
+ "reportUnusedImport": false
10
+ },
11
+ "python.testing.pytestArgs": [
12
+ "tests",
13
+ "--color=yes"
14
+ ],
15
+ "python.testing.unittestEnabled": false,
16
+ "python.testing.pytestEnabled": true,
17
+
18
+ }
@@ -0,0 +1,138 @@
1
+ Metadata-Version: 2.3
2
+ Name: rich-gradient
3
+ Version: 0.1.0
4
+ Summary: Add your description here
5
+ Author-email: Max Ludden <dev@maxludden.com>
6
+ Requires-Python: >=3.8
7
+ Requires-Dist: mkdocs-material>=9.5.27
8
+ Requires-Dist: mkdocs>=1.6.0
9
+ Requires-Dist: mkdocstrings-python>=1.10.5
10
+ Requires-Dist: mkdocstrings>=0.25.1
11
+ Requires-Dist: numpy>=2.0.0
12
+ Requires-Dist: pydantic-extra-types>=2.8.2
13
+ Requires-Dist: pydantic>=2.7.4
14
+ Requires-Dist: rich>=13.7.1
15
+ Description-Content-Type: text/markdown
16
+
17
+ # [![rich-gradient](docs/img/rich-gradient.svg)](https://maxludden.github.io/rich-gradient/)
18
+
19
+
20
+ [![Python](https://img.shields.io/badge/Python-3.9%2C%203.10%2C%203.11%2C%203.12-blue)](https://www.python.org/) [![Rye](https://img.shields.io/badge/Rye-1.0-green)](https://www.rye.org/) [![PyPI](https://img.shields.io/pypi/v/rich-gradient)](https://pypi.org/project/rich_gradient/) [![PyPI - Downloads](https://img.shields.io/pypi/dm/rich-gradient)](https://pypi.org/project/rich-gradient/)
21
+
22
+ ![gradient example](docs/img/gradient.svg)
23
+
24
+ This library is a wrapper of the great [rich](https://GitHub.com/textualize/rich) library that extends [rich.text.Text](https://github.com/Textualize/rich/blob/master/rich/text.py) to allow for the easy generation gradient text from the user inputed colors or randomly if not colors are presented.
25
+
26
+ Borrowing from [pydantic-Looextra-types](https://GitHub.com/pydantic/pydantic-extra-types)' [Color](https://github.com/pydantic/pydantic-extra-types/blob/main/pydantic_extra_types/color.py) class, rich_gradient extends the rich standard colors to include:
27
+ - 3 or 6 digit hex code (e.g. `#f00` or `#ff0000`)
28
+ - RGB color codes (e.g. `rgb(255, 0, 0)`)
29
+ - RGB tuples (e.g. `(255, 0, 0)`)
30
+ - CSS3 Color Names (e.g. `red`)
31
+
32
+ ---
33
+
34
+ Read the docs at [rich-gradient.readthedocs.io](https://rich-gradient.readthedocs.io)
35
+
36
+ ## Installation
37
+
38
+ ### Rye (Recommended)
39
+ ```bash
40
+ rye add rich-gradient
41
+ ```
42
+
43
+ ### Pip
44
+ ```bash
45
+ pip install rich-gradient
46
+ ```
47
+
48
+ ## Usage
49
+
50
+ ### Basic Gradient Example
51
+
52
+ To print a simple gradient just substitue the `Gradient` class for the `Text` class in the rich library.
53
+
54
+ ```python
55
+ from rich.console import Console
56
+ from rich_gradient import Gradient
57
+
58
+ console = Console()
59
+ console.print(Gradient("Hello, World!")
60
+ ```
61
+ ![Hello, World!](docs/img/hello_world.svg)
62
+
63
+ ---
64
+
65
+ ### Gradient with Specific Colors
66
+
67
+ If you want a bit more control of the gradient, you can specify the colors you want to use in the gradient by passing them as a list of colors to the `colors` parameter.
68
+
69
+ #### Color Formats
70
+
71
+ Color can be parsed from a variety of formats including:
72
+
73
+ ![3 or 6 digit hex colors, rgb/rgba colors, and CSS3 Named Colors](docs/img/color_formats.svg)
74
+
75
+ #### Example Code
76
+
77
+ ```python
78
+ console.print(
79
+ Gradient(
80
+ "This a gradient with specific colors.",
81
+ colors=["red", "#ff9900", "#ff0", "Lime"],
82
+ justify="center"
83
+ )
84
+ )
85
+ ```
86
+
87
+ #### Specific Color Gradient Result:
88
+
89
+ ![specific colors](docs/img/specific_color_gradient.svg)
90
+
91
+ ---
92
+
93
+ ### Rainbow Gradient Example
94
+
95
+ If four colors isn't enough, you can use the 'rainbow' parameter to generate a rainbow gradient that spans the entire spectrum of colors randomly.
96
+
97
+ ```python
98
+ console.print(
99
+ Gradient(
100
+ "This is a rainbow gradient.",
101
+ rainbow=True,
102
+ justify="center"
103
+ )
104
+ )
105
+ ```
106
+
107
+
108
+ ![Rainbow Gradient](docs/img/example_rainbow_gradient.svg)
109
+ <p style="text-align:right;">*The rainbow gradient is generated randomly each time the code is run.</p>
110
+
111
+ ---
112
+
113
+ ### Still inherits from `rich.text.Text`
114
+
115
+ Since `Gradient` is a subclass of `Text`, you can still use all the same methods and properties as you would with `Text`.
116
+
117
+ ```python
118
+ console.print(
119
+ Gradient(
120
+ "This is an underlined rainbow gradient.",
121
+ rainbow=True,
122
+ style="underline"
123
+ ),
124
+ justify="center"
125
+ )
126
+ console.line()
127
+ console.print(
128
+ Gradient(
129
+ "This is a bold italic gradient.",
130
+ style="bold italic"
131
+ ),
132
+ justify="center"
133
+ )
134
+ console.line()
135
+ ```
136
+
137
+ ![Still Text](docs/img/still_text.svg)
138
+
@@ -0,0 +1,122 @@
1
+ # [![rich-gradient](docs/img/rich-gradient.svg)](https://maxludden.github.io/rich-gradient/)
2
+
3
+
4
+ [![Python](https://img.shields.io/badge/Python-3.9%2C%203.10%2C%203.11%2C%203.12-blue)](https://www.python.org/) [![Rye](https://img.shields.io/badge/Rye-1.0-green)](https://www.rye.org/) [![PyPI](https://img.shields.io/pypi/v/rich-gradient)](https://pypi.org/project/rich_gradient/) [![PyPI - Downloads](https://img.shields.io/pypi/dm/rich-gradient)](https://pypi.org/project/rich-gradient/)
5
+
6
+ ![gradient example](docs/img/gradient.svg)
7
+
8
+ This library is a wrapper of the great [rich](https://GitHub.com/textualize/rich) library that extends [rich.text.Text](https://github.com/Textualize/rich/blob/master/rich/text.py) to allow for the easy generation gradient text from the user inputed colors or randomly if not colors are presented.
9
+
10
+ Borrowing from [pydantic-Looextra-types](https://GitHub.com/pydantic/pydantic-extra-types)' [Color](https://github.com/pydantic/pydantic-extra-types/blob/main/pydantic_extra_types/color.py) class, rich_gradient extends the rich standard colors to include:
11
+ - 3 or 6 digit hex code (e.g. `#f00` or `#ff0000`)
12
+ - RGB color codes (e.g. `rgb(255, 0, 0)`)
13
+ - RGB tuples (e.g. `(255, 0, 0)`)
14
+ - CSS3 Color Names (e.g. `red`)
15
+
16
+ ---
17
+
18
+ Read the docs at [rich-gradient.readthedocs.io](https://rich-gradient.readthedocs.io)
19
+
20
+ ## Installation
21
+
22
+ ### Rye (Recommended)
23
+ ```bash
24
+ rye add rich-gradient
25
+ ```
26
+
27
+ ### Pip
28
+ ```bash
29
+ pip install rich-gradient
30
+ ```
31
+
32
+ ## Usage
33
+
34
+ ### Basic Gradient Example
35
+
36
+ To print a simple gradient just substitue the `Gradient` class for the `Text` class in the rich library.
37
+
38
+ ```python
39
+ from rich.console import Console
40
+ from rich_gradient import Gradient
41
+
42
+ console = Console()
43
+ console.print(Gradient("Hello, World!")
44
+ ```
45
+ ![Hello, World!](docs/img/hello_world.svg)
46
+
47
+ ---
48
+
49
+ ### Gradient with Specific Colors
50
+
51
+ If you want a bit more control of the gradient, you can specify the colors you want to use in the gradient by passing them as a list of colors to the `colors` parameter.
52
+
53
+ #### Color Formats
54
+
55
+ Color can be parsed from a variety of formats including:
56
+
57
+ ![3 or 6 digit hex colors, rgb/rgba colors, and CSS3 Named Colors](docs/img/color_formats.svg)
58
+
59
+ #### Example Code
60
+
61
+ ```python
62
+ console.print(
63
+ Gradient(
64
+ "This a gradient with specific colors.",
65
+ colors=["red", "#ff9900", "#ff0", "Lime"],
66
+ justify="center"
67
+ )
68
+ )
69
+ ```
70
+
71
+ #### Specific Color Gradient Result:
72
+
73
+ ![specific colors](docs/img/specific_color_gradient.svg)
74
+
75
+ ---
76
+
77
+ ### Rainbow Gradient Example
78
+
79
+ If four colors isn't enough, you can use the 'rainbow' parameter to generate a rainbow gradient that spans the entire spectrum of colors randomly.
80
+
81
+ ```python
82
+ console.print(
83
+ Gradient(
84
+ "This is a rainbow gradient.",
85
+ rainbow=True,
86
+ justify="center"
87
+ )
88
+ )
89
+ ```
90
+
91
+
92
+ ![Rainbow Gradient](docs/img/example_rainbow_gradient.svg)
93
+ <p style="text-align:right;">*The rainbow gradient is generated randomly each time the code is run.</p>
94
+
95
+ ---
96
+
97
+ ### Still inherits from `rich.text.Text`
98
+
99
+ Since `Gradient` is a subclass of `Text`, you can still use all the same methods and properties as you would with `Text`.
100
+
101
+ ```python
102
+ console.print(
103
+ Gradient(
104
+ "This is an underlined rainbow gradient.",
105
+ rainbow=True,
106
+ style="underline"
107
+ ),
108
+ justify="center"
109
+ )
110
+ console.line()
111
+ console.print(
112
+ Gradient(
113
+ "This is a bold italic gradient.",
114
+ style="bold italic"
115
+ ),
116
+ justify="center"
117
+ )
118
+ console.line()
119
+ ```
120
+
121
+ ![Still Text](docs/img/still_text.svg)
122
+
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": "0.2",
3
+ "ignorePaths": [],
4
+ "dictionaryDefinitions": [],
5
+ "dictionaries": ["Max's Dictionary"],
6
+ "words": [],
7
+ "ignoreWords": [],
8
+ "import": []
9
+ }
@@ -0,0 +1,10 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## v0.0.1 - 2021-10-10
9
+
10
+ Initial release. Based off of MaxGradient with a simplified color model based on pydantic-extra-types.color.Color. Re-released as rich-gradient to avoid confusion with MaxGradient.
@@ -0,0 +1,11 @@
1
+ # Color
2
+
3
+ `rich-gradient`'s Color class is a subclass of `pydantic_extra_types.color.Color` that extends the rich standard colors to include:
4
+
5
+ - 3 digit hex codes (e.g. `#f00`)
6
+ - 6 digit hex codes (e.g. `#ff0000`)
7
+ - RGB color codes (e.g. `rgb(255, 0, 0)`)
8
+ - RGB tuples (e.g. `(255, 0, 0)`)
9
+ - CSS3 Color Names (e.g. `red`)
10
+
11
+ ![colors](img/colors.svg)
@@ -0,0 +1,13 @@
1
+ # Color
2
+
3
+ ::: rich_gradient.color.Color
4
+ :docstring:
5
+ :members:
6
+ :undoc-members:
7
+ :show-inheritance:
8
+ :private-members:
9
+ :special-members: __init__
10
+ :exclude-members: __weakref__
11
+ :inherited-members:
12
+ :exclude-members: __weakref__
13
+ :noindex:
@@ -0,0 +1,36 @@
1
+ # Gradient
2
+
3
+ The `Gradient` class is a subclass of `Text` that allows you to create gradients of color in your text. You can just enter text and allow rich-gradient to generate a random gradient of color for you text,specify the colors you want to use, or generate a random rainbow gradient.
4
+
5
+ ## Random Gradient
6
+
7
+ ```python
8
+ from rich import Console
9
+ from rich_gradient import Gradient
10
+
11
+ console = Console()
12
+ console.print(
13
+ Gradient(
14
+ "The quick brown fox jumps over the lazy dog."
15
+ )
16
+ )
17
+ ```
18
+
19
+ ![Random Gradient](img/random_gradient_example.svg)
20
+
21
+ ## Specific Color Gradient
22
+
23
+
24
+ You can specify the colors you want to use in your gradient by passing a list of color names, hex color codes, rgb color codes, or [`rich_gradient.color.Color`](color.md) to the `colors` parameter.
25
+
26
+ ```python
27
+ console.print(
28
+ Gradient(
29
+ "This a gradient with specific colors.",
30
+ colors=["red", "#ff9900", "#ff0", "Lime"],
31
+ justify="center"
32
+ )
33
+ )
34
+ ```
35
+
36
+ ![specific color gradient](img/specific_color_gradient.svg)
@@ -0,0 +1,13 @@
1
+ # Gradient
2
+
3
+ ::: rich_gradient.gradient.Gradient
4
+ :docstring:
5
+ :members:
6
+ :undoc-members:
7
+ :show-inheritance:
8
+ :private-members:
9
+ :special-members: __init__
10
+ :exclude-members: __weakref__
11
+ :inherited-members:
12
+ :exclude-members: __weakref__
13
+ :noindex: