-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathart.py
More file actions
134 lines (114 loc) · 3.16 KB
/
Copy pathart.py
File metadata and controls
134 lines (114 loc) · 3.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#!/usr/bin/env python3
"""Renders the Nova welcome screen — run directly to preview it."""
import math
from pathlib import Path
from rich.align import Align
from rich.console import Console
from rich.text import Text
HERE = Path(__file__).parent
ART_CENTER = (10, 31)
# Positions that render white, on top of the gradient.
# Generated from black_hole_white.txt via extract_hot_pixels.py.
HOT_PIXELS: set[tuple[int, int]] = {
(6, 27),
(6, 28),
(6, 29),
(6, 30),
(6, 31),
(6, 32),
(7, 24),
(7, 25),
(7, 26),
(7, 33),
(7, 34),
(8, 24),
(8, 35),
(8, 36),
(9, 22),
(9, 23),
(10, 22),
(10, 23),
(10, 38),
(11, 23),
(11, 38),
(12, 36),
(12, 38),
(13, 26),
(13, 27),
(13, 34),
(13, 35),
(13, 36),
(14, 26),
(14, 27),
(14, 28),
(14, 29),
(14, 30),
(14, 31),
(14, 33),
(14, 34),
}
def gradient_color(row: int, col: int) -> str:
"""Warm radial gradient: gold core fading through orange to grey."""
cr, cc = ART_CENTER
dist = math.sqrt(((row - cr) * 0.9) ** 2 + ((col - cc) * 0.45) ** 2)
if dist < 3:
return "color(226)"
elif dist < 6:
return "color(214)"
elif dist < 9:
return "color(208)"
elif dist < 12:
return "color(202)"
elif dist < 15:
return "color(166)"
elif dist < 18:
return "color(130)"
else:
return "color(240)"
def render_art() -> Text | None:
"""Return the colored braille art as a rich Text, or None if the file is missing."""
path = HERE / "black_hole.txt"
if not path.exists():
return None
lines = path.read_text(encoding="utf-8").splitlines()
text = Text(justify="center")
for row, line in enumerate(lines):
for col, char in enumerate(line):
style = "color(231)" if (row, col) in HOT_PIXELS else gradient_color(row, col)
text.append(char, style=style)
text.append("\n")
return text
def render_title() -> Text:
"""'N O V A' with a left-to-right warm gradient."""
letters = [
("N", "color(231)"),
(" ", ""),
("O", "color(227)"),
(" ", ""),
("V", "color(220)"),
(" ", ""),
("A", "color(214)"),
]
title = Text(justify="center")
for char, color in letters:
title.append(char, style=f"bold {color}" if color else "")
return title
def show_welcome(console: Console, model: str, profile_name: str) -> None:
art = render_art()
if art:
console.print(Align(art, align="center"))
else:
console.print()
console.print(Align(render_title(), align="center"))
console.print()
info = Text(justify="center")
info.append("model ", style="color(240)")
info.append(model, style="color(214)")
info.append(" profile ", style="color(240)")
info.append(profile_name, style="color(220)")
console.print(Align(info, align="center"))
console.print(Align(Text("type /help for commands", style="color(238) italic"), align="center"))
console.print()
if __name__ == "__main__":
c = Console()
show_welcome(c, model="qwen3:30b-a3b", profile_name="default")