chromatic-python 0.5.1__tar.gz → 0.6.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 (55) hide show
  1. {chromatic_python-0.5.1 → chromatic_python-0.6.0}/PKG-INFO +15 -6
  2. {chromatic_python-0.5.1 → chromatic_python-0.6.0}/README.md +14 -4
  3. {chromatic_python-0.5.1 → chromatic_python-0.6.0}/chromatic/__init__.pyi +2 -2
  4. chromatic_python-0.6.0/chromatic/__main__.py +615 -0
  5. chromatic_python-0.6.0/chromatic/_typing.py +103 -0
  6. {chromatic_python-0.5.1 → chromatic_python-0.6.0}/chromatic/_version.py +3 -3
  7. {chromatic_python-0.5.1 → chromatic_python-0.6.0}/chromatic/color/__init__.pyi +1 -1
  8. {chromatic_python-0.5.1 → chromatic_python-0.6.0}/chromatic/color/core.py +302 -277
  9. {chromatic_python-0.5.1 → chromatic_python-0.6.0}/chromatic/color/core.pyi +42 -7
  10. chromatic_python-0.6.0/chromatic/color/palette.py +506 -0
  11. {chromatic_python-0.5.1 → chromatic_python-0.6.0}/chromatic/color/palette.pyi +8 -8
  12. {chromatic_python-0.5.1 → chromatic_python-0.6.0}/chromatic/data/__init__.py +17 -12
  13. {chromatic_python-0.5.1 → chromatic_python-0.6.0}/chromatic/data/__init__.pyi +2 -2
  14. chromatic_python-0.6.0/chromatic/data/_fetchers.py +69 -0
  15. {chromatic_python-0.5.1/chromatic/data → chromatic_python-0.6.0/chromatic/data/fonts}/userfont.schema.json +6 -1
  16. chromatic_python-0.6.0/chromatic/data/userfont.py +428 -0
  17. chromatic_python-0.6.0/chromatic/data/userfont.pyi +74 -0
  18. {chromatic_python-0.5.1 → chromatic_python-0.6.0}/chromatic/demo.py +6 -73
  19. chromatic_python-0.6.0/chromatic/image/__init__.py +3 -0
  20. {chromatic_python-0.5.1 → chromatic_python-0.6.0}/chromatic/image/_array.py +226 -264
  21. {chromatic_python-0.5.1 → chromatic_python-0.6.0}/chromatic_python.egg-info/PKG-INFO +15 -6
  22. {chromatic_python-0.5.1 → chromatic_python-0.6.0}/chromatic_python.egg-info/SOURCES.txt +8 -7
  23. {chromatic_python-0.5.1 → chromatic_python-0.6.0}/chromatic_python.egg-info/requires.txt +0 -1
  24. chromatic_python-0.6.0/chromatic_python.egg-info/scm_file_list.json +41 -0
  25. chromatic_python-0.6.0/chromatic_python.egg-info/scm_version.json +8 -0
  26. {chromatic_python-0.5.1 → chromatic_python-0.6.0}/pyproject.toml +0 -1
  27. {chromatic_python-0.5.1 → chromatic_python-0.6.0}/tests/test_color_str.py +3 -42
  28. chromatic_python-0.5.1/chromatic/_typing.py +0 -441
  29. chromatic_python-0.5.1/chromatic/color/iterators.py +0 -172
  30. chromatic_python-0.5.1/chromatic/color/palette.py +0 -599
  31. chromatic_python-0.5.1/chromatic/data/_fetchers.py +0 -56
  32. chromatic_python-0.5.1/chromatic/data/fonts/consolas.ttf +0 -0
  33. chromatic_python-0.5.1/chromatic/data/userfont.py +0 -139
  34. chromatic_python-0.5.1/chromatic/data/userfont.pyi +0 -32
  35. chromatic_python-0.5.1/chromatic/image/__init__.py +0 -5
  36. {chromatic_python-0.5.1 → chromatic_python-0.6.0}/.gitattributes +0 -0
  37. {chromatic_python-0.5.1 → chromatic_python-0.6.0}/.github/dependabot.yml +0 -0
  38. {chromatic_python-0.5.1 → chromatic_python-0.6.0}/.github/workflows/publish.yml +0 -0
  39. {chromatic_python-0.5.1 → chromatic_python-0.6.0}/.gitignore +0 -0
  40. {chromatic_python-0.5.1 → chromatic_python-0.6.0}/banner.png +0 -0
  41. {chromatic_python-0.5.1 → chromatic_python-0.6.0}/chromatic/__init__.py +0 -0
  42. {chromatic_python-0.5.1 → chromatic_python-0.6.0}/chromatic/color/__init__.py +0 -0
  43. {chromatic_python-0.5.1 → chromatic_python-0.6.0}/chromatic/color/colorconv.py +0 -0
  44. {chromatic_python-0.5.1 → chromatic_python-0.6.0}/chromatic/data/fonts/vga437.ttf +0 -0
  45. {chromatic_python-0.5.1/chromatic/data → chromatic_python-0.6.0/chromatic/data/images}/butterfly.jpg +0 -0
  46. {chromatic_python-0.5.1/chromatic/data → chromatic_python-0.6.0/chromatic/data/images}/escher.png +0 -0
  47. {chromatic_python-0.5.1/chromatic/data → chromatic_python-0.6.0/chromatic/data/images}/goblin_virus.png +0 -0
  48. {chromatic_python-0.5.1/chromatic/data → chromatic_python-0.6.0/chromatic/data/images}/registry.json +0 -0
  49. {chromatic_python-0.5.1 → chromatic_python-0.6.0}/chromatic/image/__init__.pyi +0 -0
  50. {chromatic_python-0.5.1 → chromatic_python-0.6.0}/chromatic/image/_curses.py +0 -0
  51. {chromatic_python-0.5.1 → chromatic_python-0.6.0}/chromatic/image/_glyph.py +0 -0
  52. {chromatic_python-0.5.1 → chromatic_python-0.6.0}/chromatic_python.egg-info/dependency_links.txt +0 -0
  53. {chromatic_python-0.5.1 → chromatic_python-0.6.0}/chromatic_python.egg-info/top_level.txt +0 -0
  54. {chromatic_python-0.5.1 → chromatic_python-0.6.0}/setup.cfg +0 -0
  55. {chromatic_python-0.5.1 → chromatic_python-0.6.0}/tests/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: chromatic-python
3
- Version: 0.5.1
3
+ Version: 0.6.0
4
4
  Summary: ANSI art image processing and colored terminal text
5
5
  Author: crypt0lith
6
6
  License-Expression: MIT
@@ -14,7 +14,6 @@ Requires-Python: <4.0,>=3.13
14
14
  Description-Content-Type: text/markdown
15
15
  Requires-Dist: numpy<2.6,>=1.25.2
16
16
  Requires-Dist: pillow>=12.2.0
17
- Requires-Dist: networkx<4.0,>=3.0
18
17
  Requires-Dist: scipy<2.0,>=1.11.4
19
18
  Requires-Dist: opencv-python
20
19
  Requires-Dist: scikit-image
@@ -32,6 +31,7 @@ Requires-Dist: lazy_loader
32
31
  Chromatic is a library for processing and transforming ANSI escape sequences (colored terminal text).
33
32
 
34
33
  It offers a collection of algorithms and types for a variety of use cases:
34
+
35
35
  - Image-to-ASCII / Image-to-ANSI conversions.
36
36
  - ANSI art rendering, with support for user-defined fonts.
37
37
  - A `ColorStr` type for low-level control over ANSI SGR strings.
@@ -40,16 +40,18 @@ It offers a collection of algorithms and types for a variety of use cases:
40
40
  - Et Cetera 😲
41
41
 
42
42
  ### Usage
43
+
43
44
  #### Image-to-ANSI conversion
44
45
 
45
46
  Convert an image into a 2d ANSI string array, and render the ANSI array as image:
47
+
46
48
  ```python
47
49
  from chromatic.color import ansicolor4Bit
48
50
  from chromatic.image import ansi2img, img2ansi
49
- from chromatic.data import userfont, butterfly
51
+ from chromatic.data import userfonts, butterfly
50
52
 
51
53
  input_img = butterfly()
52
- font = userfont['vga437']
54
+ font = userfonts['vga437']
53
55
 
54
56
  # `char_set` is used to translate luminance to characters
55
57
  # | <- index 0 is the 'darkest'
@@ -75,6 +77,7 @@ ansi_img.show()
75
77
  ```
76
78
 
77
79
  #### ColorStr
80
+
78
81
  ```python
79
82
  from chromatic import ColorStr
80
83
 
@@ -88,6 +91,7 @@ assert red_fg.ansi == b'\x1b[38;5;196m'
88
91
  ```
89
92
 
90
93
  `ColorStr` will parse raw SGR sequences, and accepts different types for `fg` and `bg`:
94
+
91
95
  ```python
92
96
  from chromatic import ColorStr
93
97
 
@@ -98,6 +102,7 @@ assert red_fg == ColorStr('[*]', fg=(0xFF, 0, 0), ansi_type='8b')
98
102
  ```
99
103
 
100
104
  ANSI color format can be specified with `ColorStr(ansi_type=...)`, or as a new object via `ColorStr.as_ansi_type()`:
105
+
101
106
  ```python
102
107
  from chromatic import ColorStr, ansicolor4Bit, ansicolor24Bit, ansicolor8Bit
103
108
 
@@ -105,7 +110,7 @@ from chromatic import ColorStr, ansicolor4Bit, ansicolor24Bit, ansicolor8Bit
105
110
  assert all(
106
111
  ansi_type.alias == alias
107
112
  for ansi_type, alias in [
108
- (ansicolor4Bit, '4b'),
113
+ (ansicolor4Bit, '4b'),
109
114
  (ansicolor8Bit, '8b'),
110
115
  (ansicolor24Bit, '24b'),
111
116
  ]
@@ -120,6 +125,7 @@ assert a_16color.ansi_format is ansicolor4Bit and a_16color.ansi == b'\x1b[31m'
120
125
  ```
121
126
 
122
127
  Adding and removing SGR parameters from a `ColorStr`:
128
+
123
129
  ```python
124
130
  import chromatic as cm
125
131
 
@@ -139,10 +145,13 @@ assert bold_str == unbold_str + cm.SgrParameter.BOLD # __add__ can also be used
139
145
  ```
140
146
 
141
147
  ### Installation
148
+
142
149
  Install the package using `pip`:
143
- ```bash
150
+
151
+ ```shell
144
152
  pip install chromatic-python
145
153
  ```
146
154
 
147
155
  ### Credits
156
+
148
157
  Banner artwork: [main rules by Crasher (2002)](https://16colo.rs/pack/galza-14/CRS-MAIN.ANS)
@@ -8,6 +8,7 @@
8
8
  Chromatic is a library for processing and transforming ANSI escape sequences (colored terminal text).
9
9
 
10
10
  It offers a collection of algorithms and types for a variety of use cases:
11
+
11
12
  - Image-to-ASCII / Image-to-ANSI conversions.
12
13
  - ANSI art rendering, with support for user-defined fonts.
13
14
  - A `ColorStr` type for low-level control over ANSI SGR strings.
@@ -16,16 +17,18 @@ It offers a collection of algorithms and types for a variety of use cases:
16
17
  - Et Cetera 😲
17
18
 
18
19
  ### Usage
20
+
19
21
  #### Image-to-ANSI conversion
20
22
 
21
23
  Convert an image into a 2d ANSI string array, and render the ANSI array as image:
24
+
22
25
  ```python
23
26
  from chromatic.color import ansicolor4Bit
24
27
  from chromatic.image import ansi2img, img2ansi
25
- from chromatic.data import userfont, butterfly
28
+ from chromatic.data import userfonts, butterfly
26
29
 
27
30
  input_img = butterfly()
28
- font = userfont['vga437']
31
+ font = userfonts['vga437']
29
32
 
30
33
  # `char_set` is used to translate luminance to characters
31
34
  # | <- index 0 is the 'darkest'
@@ -51,6 +54,7 @@ ansi_img.show()
51
54
  ```
52
55
 
53
56
  #### ColorStr
57
+
54
58
  ```python
55
59
  from chromatic import ColorStr
56
60
 
@@ -64,6 +68,7 @@ assert red_fg.ansi == b'\x1b[38;5;196m'
64
68
  ```
65
69
 
66
70
  `ColorStr` will parse raw SGR sequences, and accepts different types for `fg` and `bg`:
71
+
67
72
  ```python
68
73
  from chromatic import ColorStr
69
74
 
@@ -74,6 +79,7 @@ assert red_fg == ColorStr('[*]', fg=(0xFF, 0, 0), ansi_type='8b')
74
79
  ```
75
80
 
76
81
  ANSI color format can be specified with `ColorStr(ansi_type=...)`, or as a new object via `ColorStr.as_ansi_type()`:
82
+
77
83
  ```python
78
84
  from chromatic import ColorStr, ansicolor4Bit, ansicolor24Bit, ansicolor8Bit
79
85
 
@@ -81,7 +87,7 @@ from chromatic import ColorStr, ansicolor4Bit, ansicolor24Bit, ansicolor8Bit
81
87
  assert all(
82
88
  ansi_type.alias == alias
83
89
  for ansi_type, alias in [
84
- (ansicolor4Bit, '4b'),
90
+ (ansicolor4Bit, '4b'),
85
91
  (ansicolor8Bit, '8b'),
86
92
  (ansicolor24Bit, '24b'),
87
93
  ]
@@ -96,6 +102,7 @@ assert a_16color.ansi_format is ansicolor4Bit and a_16color.ansi == b'\x1b[31m'
96
102
  ```
97
103
 
98
104
  Adding and removing SGR parameters from a `ColorStr`:
105
+
99
106
  ```python
100
107
  import chromatic as cm
101
108
 
@@ -115,10 +122,13 @@ assert bold_str == unbold_str + cm.SgrParameter.BOLD # __add__ can also be used
115
122
  ```
116
123
 
117
124
  ### Installation
125
+
118
126
  Install the package using `pip`:
119
- ```bash
127
+
128
+ ```shell
120
129
  pip install chromatic-python
121
130
  ```
122
131
 
123
132
  ### Credits
133
+
124
134
  Banner artwork: [main rules by Crasher (2002)](https://16colo.rs/pack/galza-14/CRS-MAIN.ANS)
@@ -42,7 +42,7 @@ __all__ = [
42
42
  'sort_glyphs',
43
43
  'to_sgr_array',
44
44
  'ttf_extract_codepoints',
45
- 'userfont',
45
+ 'userfonts',
46
46
  'set_default_ansi',
47
47
  ]
48
48
  from . import color, data, image
@@ -67,7 +67,7 @@ from .color import (
67
67
  rgb2int,
68
68
  set_default_ansi,
69
69
  )
70
- from .data import UserFont, register_userfont, userfont
70
+ from .data import UserFont, register_userfont, userfonts
71
71
  from .image import (
72
72
  AnsiImage,
73
73
  ansi2img,