kalido 1.0.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.
kalido-1.0.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SurfyGalaxy
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
kalido-1.0.0/PKG-INFO ADDED
@@ -0,0 +1,105 @@
1
+ Metadata-Version: 2.4
2
+ Name: kalido
3
+ Version: 1.0.0
4
+ Summary: A terminal colouriser
5
+ Author-email: SurfyGalaxy <surfygalaxy@proton.me>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 SurfyGalaxy
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Classifier: Programming Language :: Python :: 3
29
+ Classifier: License :: OSI Approved :: MIT License
30
+ Classifier: Operating System :: OS Independent
31
+ Requires-Python: >=3.8
32
+ Description-Content-Type: text/markdown
33
+ License-File: LICENSE
34
+ Requires-Dist: pyyaml
35
+ Dynamic: license-file
36
+
37
+ # Kalido
38
+
39
+ A python-based colouriser inspired by `lolcat` and `kekcat`, capable of handling both escape sequences and streamed input
40
+
41
+ ## Installation
42
+
43
+ Kalido is easily downloaded, simply run:
44
+ ```bash
45
+ pip install kalido
46
+ ```
47
+
48
+ ## Arguments
49
+
50
+ ```bash
51
+ --stops <list> # Default = "random"
52
+ --count <int> # Default = 5
53
+ --size <int> # Default = 1
54
+ ```
55
+ <br><hr><br>
56
+
57
+ ### --stops
58
+
59
+ Define a list of hex codes which the gradient will go between, or alternatively use a premade template
60
+
61
+ #### Examples:
62
+ `--stops "#000000" "#FFFFFF"`
63
+ Creates a gradient between black and white
64
+
65
+ `--stops "#FFD800" "#790293" "#FFD800"`
66
+ Creates a gradient between yellow and purple, before returning to yellow
67
+
68
+ `--stops aroace`
69
+ Uses the premade gradient of the aroace flag
70
+
71
+ #### Presets:
72
+ - Rainbow
73
+ - Lesbian
74
+ - Gay (MLM)
75
+ - Bisexual
76
+ - Transgender
77
+ - Queer
78
+ - Intersex
79
+ - Aroace
80
+ - All (Combines every flag end-to-end)
81
+ - Random (Will pick any preset)
82
+
83
+ <hr>
84
+
85
+ ### --count
86
+
87
+ Define how many additional colours the gradient will have between your stops
88
+
89
+ Use `0` if you want there to be no additional colours added
90
+
91
+ <hr>
92
+
93
+ ### --size
94
+
95
+ Define how many characters each colour will cover.
96
+
97
+ <br><hr><br>
98
+
99
+ ## Known bugs
100
+
101
+ - Interactive programs sometimes will leak escape sequences
102
+
103
+ ## AI Disclaimer
104
+
105
+ No AI was used to generate code nor this README
kalido-1.0.0/README.md ADDED
@@ -0,0 +1,69 @@
1
+ # Kalido
2
+
3
+ A python-based colouriser inspired by `lolcat` and `kekcat`, capable of handling both escape sequences and streamed input
4
+
5
+ ## Installation
6
+
7
+ Kalido is easily downloaded, simply run:
8
+ ```bash
9
+ pip install kalido
10
+ ```
11
+
12
+ ## Arguments
13
+
14
+ ```bash
15
+ --stops <list> # Default = "random"
16
+ --count <int> # Default = 5
17
+ --size <int> # Default = 1
18
+ ```
19
+ <br><hr><br>
20
+
21
+ ### --stops
22
+
23
+ Define a list of hex codes which the gradient will go between, or alternatively use a premade template
24
+
25
+ #### Examples:
26
+ `--stops "#000000" "#FFFFFF"`
27
+ Creates a gradient between black and white
28
+
29
+ `--stops "#FFD800" "#790293" "#FFD800"`
30
+ Creates a gradient between yellow and purple, before returning to yellow
31
+
32
+ `--stops aroace`
33
+ Uses the premade gradient of the aroace flag
34
+
35
+ #### Presets:
36
+ - Rainbow
37
+ - Lesbian
38
+ - Gay (MLM)
39
+ - Bisexual
40
+ - Transgender
41
+ - Queer
42
+ - Intersex
43
+ - Aroace
44
+ - All (Combines every flag end-to-end)
45
+ - Random (Will pick any preset)
46
+
47
+ <hr>
48
+
49
+ ### --count
50
+
51
+ Define how many additional colours the gradient will have between your stops
52
+
53
+ Use `0` if you want there to be no additional colours added
54
+
55
+ <hr>
56
+
57
+ ### --size
58
+
59
+ Define how many characters each colour will cover.
60
+
61
+ <br><hr><br>
62
+
63
+ ## Known bugs
64
+
65
+ - Interactive programs sometimes will leak escape sequences
66
+
67
+ ## AI Disclaimer
68
+
69
+ No AI was used to generate code nor this README
@@ -0,0 +1,25 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77.0.3", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "kalido"
7
+ version = "1.0.0"
8
+ authors = [
9
+ {name = "SurfyGalaxy", email = "surfygalaxy@proton.me"},
10
+ ]
11
+ description = "A terminal colouriser"
12
+ readme = "README.md"
13
+ requires-python = ">=3.8"
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "License :: OSI Approved :: MIT License",
17
+ "Operating System :: OS Independent",
18
+ ]
19
+ license = {file = "LICENSE"}
20
+ dependencies = [
21
+ "pyyaml",
22
+ ]
23
+
24
+ [project.scripts]
25
+ kalido = "kalido.__main__:main"
kalido-1.0.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1 @@
1
+ __version__ = "1.0.0"
@@ -0,0 +1,113 @@
1
+ """
2
+ - Escape sequences start with \x1b
3
+ - CSI sequences usually start with \x1b[
4
+ - CSI sequences end with a single final byte in @ A-Z [ \\ ] ^ _ ` a-z ~
5
+ - If the final byte is 'm', the sequence is a colour/style code (SGR)
6
+ → discard the entire sequence
7
+ - Otherwise, preserve the sequence unchanged
8
+ - Everything outside escape sequences is normal printable text
9
+ """
10
+
11
+ import sys
12
+ import os
13
+ import pathlib
14
+ import yaml
15
+ from kalido import functions as func
16
+ import argparse
17
+ import random
18
+
19
+ script_dir = pathlib.Path(__file__).parent
20
+ presets_path = script_dir / "presets.yaml"
21
+ with open(presets_path) as f: # Copied from my other project, Clide
22
+ presets = yaml.safe_load(f)
23
+
24
+ STATE = "NORMAL"
25
+ seq = ""
26
+ rgb_stops = []
27
+
28
+ sys.stdout.reconfigure(line_buffering=True)
29
+ parser = argparse.ArgumentParser()
30
+
31
+ parser.add_argument(
32
+ "--stops",
33
+ nargs="+",
34
+ default=["random"],
35
+ help="gradient color stops (hex values)",
36
+ )
37
+ parser.add_argument(
38
+ "--count",
39
+ type=int,
40
+ default=5,
41
+ help="The amount of intermediate values to add between stops",
42
+ )
43
+ parser.add_argument(
44
+ "--size",
45
+ type=int,
46
+ default=1,
47
+ help="How large each colour is before moving to next colour"
48
+ )
49
+ args = parser.parse_args()
50
+ stops = args.stops
51
+ count = args.count
52
+ size = args.size
53
+ # This is a list of hex codes with the # still
54
+
55
+ if stops[0] in presets:
56
+ stops = presets[stops[0]]
57
+ elif stops[0] == "random":
58
+ random_flag = random.choice(list(presets.keys()))
59
+ stops = presets[random_flag]
60
+
61
+
62
+
63
+ stops = func.create_gradient(stops, count)
64
+ index = 0
65
+ size_index = size
66
+
67
+ while True:
68
+ c = sys.stdin.read(1)
69
+ if not c:
70
+ break
71
+
72
+ if STATE == "NORMAL":
73
+ if c == "\x1b":
74
+ STATE = "ESC"
75
+ seq = c
76
+ else:
77
+ sys.stdout.write(func.colourise(stops, c, index))
78
+ sys.stdout.flush()
79
+ if size_index != 1:
80
+ size_index -= 1
81
+ else:
82
+ if index == len(stops) -1:
83
+ index = 0
84
+ else:
85
+ index += 1
86
+ size_index = size
87
+
88
+ elif STATE == "ESC":
89
+ seq += c
90
+
91
+ if c == "[":
92
+ STATE = "CSI"
93
+ else:
94
+ # not CSI, just output and reset
95
+ sys.stdout.write(seq)
96
+ sys.stdout.flush()
97
+ STATE = "NORMAL"
98
+
99
+ elif STATE == "CSI":
100
+ seq += c
101
+
102
+ if '@' <= c <= '~': # final byte
103
+
104
+ if c != "m":
105
+ sys.stdout.write(seq) # keep non-colour sequences
106
+ sys.stdout.flush()
107
+
108
+ # always reset once
109
+ STATE = "NORMAL"
110
+ seq = ""
111
+
112
+ sys.stdout.write('\n')
113
+ sys.stdout.flush()
@@ -0,0 +1,53 @@
1
+ def hex_to_rbg(stops):
2
+ rgb_stops = []
3
+ stops = [code[1:] for code in stops] # Strip the leading # to make my life easier
4
+
5
+ for code in stops:
6
+ red = int(code[:2], 16)
7
+ green = int(code[2:4], 16)
8
+ blue = int(code[4:], 16)
9
+ rgb_stops.append((red, green, blue))
10
+ return rgb_stops
11
+
12
+ def rgb_to_hex(stops):
13
+ hex_list = []
14
+ index = 0
15
+ for rgb in stops:
16
+ hex_colour = "#{:02X}{:02X}{:02X}".format(*stops[index])
17
+ hex_list.append(hex_colour)
18
+ index += 1
19
+ return hex_list
20
+
21
+
22
+
23
+ def create_gradient(stops, count):
24
+ stops = hex_to_rbg(stops) # to get pure RGB
25
+ percent = 1 / (count + 1)
26
+ gradient = []
27
+ segments = len(stops) - 1 # to count how many we need to generate
28
+
29
+ for index in range(segments):
30
+ red_1, green_1, blue_1 = stops[index]
31
+ red_2, green_2, blue_2 = stops[index + 1]
32
+
33
+ # Actually generate the parts
34
+ for step in range(count):
35
+ # Percent raises to fill out the gap
36
+ percent = step / count
37
+
38
+ red = int(red_1 + (percent * (red_2 - red_1)))
39
+ green = int(green_1 + (percent * (green_2 - green_1)))
40
+ blue = int(blue_1 + (percent * (blue_2 - blue_1)))
41
+
42
+ gradient.append((red, green, blue))
43
+
44
+ # Tidy it up
45
+ gradient.append(stops[-1])
46
+ return gradient
47
+
48
+ def colour_char(char: str, colour: tuple) -> str:
49
+ return f"\x1b[38;2;{colour[0]};{colour[1]};{colour[2]}m{char}\x1b[0m"
50
+
51
+ def colourise(stops, char, index):
52
+ colour = stops[index]
53
+ return colour_char(char, colour)
@@ -0,0 +1,105 @@
1
+ Metadata-Version: 2.4
2
+ Name: kalido
3
+ Version: 1.0.0
4
+ Summary: A terminal colouriser
5
+ Author-email: SurfyGalaxy <surfygalaxy@proton.me>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 SurfyGalaxy
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Classifier: Programming Language :: Python :: 3
29
+ Classifier: License :: OSI Approved :: MIT License
30
+ Classifier: Operating System :: OS Independent
31
+ Requires-Python: >=3.8
32
+ Description-Content-Type: text/markdown
33
+ License-File: LICENSE
34
+ Requires-Dist: pyyaml
35
+ Dynamic: license-file
36
+
37
+ # Kalido
38
+
39
+ A python-based colouriser inspired by `lolcat` and `kekcat`, capable of handling both escape sequences and streamed input
40
+
41
+ ## Installation
42
+
43
+ Kalido is easily downloaded, simply run:
44
+ ```bash
45
+ pip install kalido
46
+ ```
47
+
48
+ ## Arguments
49
+
50
+ ```bash
51
+ --stops <list> # Default = "random"
52
+ --count <int> # Default = 5
53
+ --size <int> # Default = 1
54
+ ```
55
+ <br><hr><br>
56
+
57
+ ### --stops
58
+
59
+ Define a list of hex codes which the gradient will go between, or alternatively use a premade template
60
+
61
+ #### Examples:
62
+ `--stops "#000000" "#FFFFFF"`
63
+ Creates a gradient between black and white
64
+
65
+ `--stops "#FFD800" "#790293" "#FFD800"`
66
+ Creates a gradient between yellow and purple, before returning to yellow
67
+
68
+ `--stops aroace`
69
+ Uses the premade gradient of the aroace flag
70
+
71
+ #### Presets:
72
+ - Rainbow
73
+ - Lesbian
74
+ - Gay (MLM)
75
+ - Bisexual
76
+ - Transgender
77
+ - Queer
78
+ - Intersex
79
+ - Aroace
80
+ - All (Combines every flag end-to-end)
81
+ - Random (Will pick any preset)
82
+
83
+ <hr>
84
+
85
+ ### --count
86
+
87
+ Define how many additional colours the gradient will have between your stops
88
+
89
+ Use `0` if you want there to be no additional colours added
90
+
91
+ <hr>
92
+
93
+ ### --size
94
+
95
+ Define how many characters each colour will cover.
96
+
97
+ <br><hr><br>
98
+
99
+ ## Known bugs
100
+
101
+ - Interactive programs sometimes will leak escape sequences
102
+
103
+ ## AI Disclaimer
104
+
105
+ No AI was used to generate code nor this README
@@ -0,0 +1,12 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/kalido/__init__.py
5
+ src/kalido/__main__.py
6
+ src/kalido/functions.py
7
+ src/kalido.egg-info/PKG-INFO
8
+ src/kalido.egg-info/SOURCES.txt
9
+ src/kalido.egg-info/dependency_links.txt
10
+ src/kalido.egg-info/entry_points.txt
11
+ src/kalido.egg-info/requires.txt
12
+ src/kalido.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ kalido = kalido.__main__:main
@@ -0,0 +1 @@
1
+ pyyaml
@@ -0,0 +1 @@
1
+ kalido