curses-themes 0.1__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.
- curses_themes-0.1/LICENSE +23 -0
- curses_themes-0.1/PKG-INFO +337 -0
- curses_themes-0.1/README.md +284 -0
- curses_themes-0.1/curses_themes/__init__.py +110 -0
- curses_themes-0.1/curses_themes/colors.py +324 -0
- curses_themes-0.1/curses_themes/manager.py +372 -0
- curses_themes-0.1/curses_themes/theme.py +468 -0
- curses_themes-0.1/curses_themes/theme3d.py +499 -0
- curses_themes-0.1/curses_themes/themes/__init__.py +45 -0
- curses_themes-0.1/curses_themes/themes/borland3d.py +362 -0
- curses_themes-0.1/curses_themes/themes/dark.py +125 -0
- curses_themes-0.1/curses_themes/themes/dbase3.py +169 -0
- curses_themes-0.1/curses_themes/themes/dbase4.py +180 -0
- curses_themes-0.1/curses_themes/themes/dbase4_3d.py +294 -0
- curses_themes-0.1/curses_themes/themes/default.py +125 -0
- curses_themes-0.1/curses_themes/themes/dos.py +179 -0
- curses_themes-0.1/curses_themes/themes/light.py +124 -0
- curses_themes-0.1/curses_themes/themes/ti994a.py +136 -0
- curses_themes-0.1/curses_themes/themes/trs80.py +153 -0
- curses_themes-0.1/curses_themes.egg-info/PKG-INFO +337 -0
- curses_themes-0.1/curses_themes.egg-info/SOURCES.txt +24 -0
- curses_themes-0.1/curses_themes.egg-info/dependency_links.txt +1 -0
- curses_themes-0.1/curses_themes.egg-info/requires.txt +26 -0
- curses_themes-0.1/curses_themes.egg-info/top_level.txt +1 -0
- curses_themes-0.1/pyproject.toml +312 -0
- curses_themes-0.1/setup.cfg +4 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
GNU GENERAL PUBLIC LICENSE
|
|
2
|
+
Version 3, 29 June 2007
|
|
3
|
+
|
|
4
|
+
Copyright (C) 2026 FlossWare
|
|
5
|
+
|
|
6
|
+
This program is free software: you can redistribute it and/or modify
|
|
7
|
+
it under the terms of the GNU General Public License as published by
|
|
8
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
(at your option) any later version.
|
|
10
|
+
|
|
11
|
+
This program is distributed in the hope that it will be useful,
|
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
GNU General Public License for more details.
|
|
15
|
+
|
|
16
|
+
You should have received a copy of the GNU General Public License
|
|
17
|
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
18
|
+
|
|
19
|
+
GNU GENERAL PUBLIC LICENSE
|
|
20
|
+
Version 3, 29 June 2007
|
|
21
|
+
|
|
22
|
+
[Full GPL-3.0 license text follows - abbreviated here for brevity]
|
|
23
|
+
For the complete license text, see: https://www.gnu.org/licenses/gpl-3.0.txt
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: curses-themes
|
|
3
|
+
Version: 0.1
|
|
4
|
+
Summary: Lightweight theme support for Python curses applications
|
|
5
|
+
Author-email: FlossWare <scot.floess@gmail.com>
|
|
6
|
+
Maintainer-email: FlossWare <scot.floess@gmail.com>
|
|
7
|
+
License: GPL-3.0
|
|
8
|
+
Project-URL: Homepage, https://github.com/FlossWare/curses-themes
|
|
9
|
+
Project-URL: Repository, https://github.com/FlossWare/curses-themes
|
|
10
|
+
Project-URL: Documentation, https://github.com/FlossWare/curses-themes/blob/main/README.md
|
|
11
|
+
Project-URL: Bug Tracker, https://github.com/FlossWare/curses-themes/issues
|
|
12
|
+
Keywords: curses,themes,terminal,tui,ui
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
|
+
Classifier: Topic :: Terminals
|
|
24
|
+
Requires-Python: >=3.9
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
29
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
30
|
+
Requires-Dist: pytest-xdist>=3.0.0; extra == "dev"
|
|
31
|
+
Requires-Dist: pytest-timeout>=2.1.0; extra == "dev"
|
|
32
|
+
Requires-Dist: pytest-mock>=3.10.0; extra == "dev"
|
|
33
|
+
Requires-Dist: coverage[toml]>=7.0.0; extra == "dev"
|
|
34
|
+
Requires-Dist: radon>=5.1.0; extra == "dev"
|
|
35
|
+
Requires-Dist: xenon>=0.9.0; extra == "dev"
|
|
36
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
37
|
+
Requires-Dist: isort>=5.12.0; extra == "dev"
|
|
38
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
39
|
+
Requires-Dist: flake8>=6.0.0; extra == "dev"
|
|
40
|
+
Requires-Dist: flake8-bugbear>=23.0.0; extra == "dev"
|
|
41
|
+
Requires-Dist: flake8-comprehensions>=3.10.0; extra == "dev"
|
|
42
|
+
Requires-Dist: flake8-simplify>=0.20.0; extra == "dev"
|
|
43
|
+
Requires-Dist: pylint>=2.17.0; extra == "dev"
|
|
44
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
45
|
+
Requires-Dist: bandit>=1.7.5; extra == "dev"
|
|
46
|
+
Requires-Dist: safety>=2.3.0; extra == "dev"
|
|
47
|
+
Requires-Dist: sphinx>=5.0.0; extra == "dev"
|
|
48
|
+
Requires-Dist: sphinx-rtd-theme>=1.2.0; extra == "dev"
|
|
49
|
+
Requires-Dist: build>=0.10.0; extra == "dev"
|
|
50
|
+
Requires-Dist: wheel>=0.40.0; extra == "dev"
|
|
51
|
+
Requires-Dist: setuptools>=65.0.0; extra == "dev"
|
|
52
|
+
Dynamic: license-file
|
|
53
|
+
|
|
54
|
+
# curses-themes
|
|
55
|
+
|
|
56
|
+
**Lightweight theme support for Python curses applications**
|
|
57
|
+
|
|
58
|
+
[](https://www.gnu.org/licenses/gpl-3.0)
|
|
59
|
+
[](https://www.python.org/downloads/)
|
|
60
|
+
[](https://codecov.io/gh/FlossWare/curses-themes)
|
|
61
|
+
[](https://github.com/FlossWare/curses-themes/actions/workflows/quality.yml)
|
|
62
|
+
[](https://github.com/FlossWare/curses-themes/actions/workflows/coverage.yml)
|
|
63
|
+
|
|
64
|
+
Inspired by [FlossWare curses-java](https://github.com/FlossWare/curses-java), this library brings professional theme support to Python's standard `curses` module with zero external dependencies.
|
|
65
|
+
|
|
66
|
+
## Features
|
|
67
|
+
|
|
68
|
+
- 🎨 **8 Built-in Themes**: Modern, classic IDE, and retro computer themes
|
|
69
|
+
- 🔌 **Pluggable Architecture**: Easy custom theme creation
|
|
70
|
+
- 🎯 **Semantic Colors**: `primary`, `success`, `error`, `warning`, `info`
|
|
71
|
+
- 🔄 **Runtime Theme Switching**: Change themes on-the-fly
|
|
72
|
+
- 🖥️ **Terminal Aware**: Auto-detects 8/16/256 color support with fallbacks
|
|
73
|
+
- 📦 **Zero Dependencies**: Only uses Python standard library `curses`
|
|
74
|
+
- 🧪 **Thoroughly Tested**: Comprehensive test coverage
|
|
75
|
+
- 📚 **Well Documented**: API reference, examples, and guides
|
|
76
|
+
|
|
77
|
+
## Quick Start
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
#!/usr/bin/env python3
|
|
81
|
+
import curses
|
|
82
|
+
from curses_themes import ThemeManager
|
|
83
|
+
|
|
84
|
+
def main(stdscr):
|
|
85
|
+
# Load and apply a theme
|
|
86
|
+
theme = ThemeManager.load('dracula')
|
|
87
|
+
theme.apply(stdscr)
|
|
88
|
+
|
|
89
|
+
# Use semantic colors
|
|
90
|
+
stdscr.addstr(0, 0, "Success!", theme.colors.success)
|
|
91
|
+
stdscr.addstr(1, 0, "Error!", theme.colors.error)
|
|
92
|
+
stdscr.addstr(2, 0, "Warning!", theme.colors.warning)
|
|
93
|
+
|
|
94
|
+
# Draw themed boxes
|
|
95
|
+
theme.draw_box(stdscr, 4, 2, 10, 40, title="My Panel")
|
|
96
|
+
|
|
97
|
+
stdscr.refresh()
|
|
98
|
+
stdscr.getch()
|
|
99
|
+
|
|
100
|
+
if __name__ == "__main__":
|
|
101
|
+
curses.wrapper(main)
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Installation
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
pip install curses-themes
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Or install from source:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
git clone https://github.com/FlossWare/curses-themes.git
|
|
114
|
+
cd curses-themes
|
|
115
|
+
pip install -e .
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Theme Gallery
|
|
119
|
+
|
|
120
|
+
### Modern Themes
|
|
121
|
+
|
|
122
|
+
<table>
|
|
123
|
+
<tr>
|
|
124
|
+
<td width="33%" align="center">
|
|
125
|
+
<img src="screenshots/default.png" width="300" alt="Default Theme"><br>
|
|
126
|
+
<strong>Default</strong><br>
|
|
127
|
+
Classic terminal aesthetic<br>
|
|
128
|
+
<em>Timeless</em>
|
|
129
|
+
</td>
|
|
130
|
+
<td width="33%" align="center">
|
|
131
|
+
<img src="screenshots/dark.png" width="300" alt="Dark Theme"><br>
|
|
132
|
+
<strong>Dark</strong><br>
|
|
133
|
+
Professional dark mode<br>
|
|
134
|
+
<em>Modern</em>
|
|
135
|
+
</td>
|
|
136
|
+
<td width="33%" align="center">
|
|
137
|
+
<img src="screenshots/light.png" width="300" alt="Light Theme"><br>
|
|
138
|
+
<strong>Light</strong><br>
|
|
139
|
+
High contrast for bright environments<br>
|
|
140
|
+
<em>Modern</em>
|
|
141
|
+
</td>
|
|
142
|
+
</tr>
|
|
143
|
+
</table>
|
|
144
|
+
|
|
145
|
+
### Retro Computer Themes
|
|
146
|
+
|
|
147
|
+
<table>
|
|
148
|
+
<tr>
|
|
149
|
+
<td width="50%" align="center">
|
|
150
|
+
<img src="screenshots/ti-99-4a.png" width="300" alt="TI-99/4A Theme"><br>
|
|
151
|
+
<strong>TI-99/4A</strong><br>
|
|
152
|
+
Texas Instruments home computer<br>
|
|
153
|
+
<em>1981-1984</em>
|
|
154
|
+
</td>
|
|
155
|
+
<td width="50%" align="center">
|
|
156
|
+
<img src="screenshots/trs-80.png" width="300" alt="TRS-80 Theme"><br>
|
|
157
|
+
<strong>TRS-80</strong><br>
|
|
158
|
+
Tandy/Radio Shack monochrome<br>
|
|
159
|
+
<em>1980-1983</em>
|
|
160
|
+
</td>
|
|
161
|
+
</tr>
|
|
162
|
+
</table>
|
|
163
|
+
|
|
164
|
+
### Business Software Themes
|
|
165
|
+
|
|
166
|
+
<table>
|
|
167
|
+
<tr>
|
|
168
|
+
<td width="33%" align="center">
|
|
169
|
+
<img src="screenshots/dos.png" width="300" alt="DOS Theme"><br>
|
|
170
|
+
<strong>DOS</strong><br>
|
|
171
|
+
Classic MS-DOS interface<br>
|
|
172
|
+
<em>1981-1995</em>
|
|
173
|
+
</td>
|
|
174
|
+
<td width="33%" align="center">
|
|
175
|
+
<img src="screenshots/dbase-iii.png" width="300" alt="dBASE III Theme"><br>
|
|
176
|
+
<strong>dBASE III</strong><br>
|
|
177
|
+
Iconic database software<br>
|
|
178
|
+
<em>1984-1985</em>
|
|
179
|
+
</td>
|
|
180
|
+
<td width="33%" align="center">
|
|
181
|
+
<img src="screenshots/dbase-iv.png" width="300" alt="dBASE IV Theme"><br>
|
|
182
|
+
<strong>dBASE IV</strong><br>
|
|
183
|
+
Windowed database interface<br>
|
|
184
|
+
<em>1988-1993</em>
|
|
185
|
+
</td>
|
|
186
|
+
</tr>
|
|
187
|
+
</table>
|
|
188
|
+
|
|
189
|
+
### 3D Effect Themes
|
|
190
|
+
|
|
191
|
+
<table>
|
|
192
|
+
<tr>
|
|
193
|
+
<td width="50%" align="center">
|
|
194
|
+
<img src="screenshots/borland-3d.png" width="300" alt="Borland 3D Theme"><br>
|
|
195
|
+
<strong>Borland 3D</strong><br>
|
|
196
|
+
Turbo Vision 3D look<br>
|
|
197
|
+
<em>1990-1997</em>
|
|
198
|
+
</td>
|
|
199
|
+
<td width="50%" align="center">
|
|
200
|
+
<img src="screenshots/dbase-iv-3d.png" width="300" alt="dBASE IV 3D Theme"><br>
|
|
201
|
+
<strong>dBASE IV 3D</strong><br>
|
|
202
|
+
3D windowed database UI<br>
|
|
203
|
+
<em>1988-1993</em>
|
|
204
|
+
</td>
|
|
205
|
+
</tr>
|
|
206
|
+
</table>
|
|
207
|
+
|
|
208
|
+
### Theme Comparison
|
|
209
|
+
|
|
210
|
+
| Theme | Era | Style | Colors | Best For |
|
|
211
|
+
|-------|-----|-------|--------|----------|
|
|
212
|
+
| Default | Timeless | Minimal | B/W | Universal compatibility |
|
|
213
|
+
| Dark | Modern | Professional | Blues/Greens | Low-light coding |
|
|
214
|
+
| Light | Modern | Clean | High contrast | Bright environments |
|
|
215
|
+
| TI-99/4A | 1981-1984 | Retro | Cyan/Blue | Nostalgia, gaming UIs |
|
|
216
|
+
| TRS-80 | 1980-1983 | Monochrome | White/Black | Authentic retro feel |
|
|
217
|
+
| DOS | 1981-1995 | Classic | White/Yellow | System utilities |
|
|
218
|
+
| dBASE III | 1984-1985 | Business | Cyan menus | Database applications |
|
|
219
|
+
| dBASE IV | 1988-1993 | Windowed | Blue background | Modern database UIs |
|
|
220
|
+
| Borland 3D | 1990-1997 | 3D Effect | Gray/Blue shadows | IDE-style applications |
|
|
221
|
+
| dBASE IV 3D | 1988-1993 | 3D Windowed | Blue with depth | Sophisticated database UIs |
|
|
222
|
+
|
|
223
|
+
## Creating Custom Themes
|
|
224
|
+
|
|
225
|
+
```python
|
|
226
|
+
from curses_themes import Theme, ThemeManager
|
|
227
|
+
|
|
228
|
+
class SolarizedTheme(Theme):
|
|
229
|
+
"""Solarized Dark theme"""
|
|
230
|
+
|
|
231
|
+
def __init__(self):
|
|
232
|
+
super().__init__(
|
|
233
|
+
name="Solarized Dark",
|
|
234
|
+
description="Precision colors for machines and people",
|
|
235
|
+
author="Ethan Schoonover"
|
|
236
|
+
)
|
|
237
|
+
|
|
238
|
+
def get_color_map(self):
|
|
239
|
+
return {
|
|
240
|
+
'background': (0, 43, 54),
|
|
241
|
+
'foreground': (131, 148, 150),
|
|
242
|
+
'primary': (38, 139, 210),
|
|
243
|
+
'success': (133, 153, 0),
|
|
244
|
+
'error': (220, 50, 47),
|
|
245
|
+
'warning': (181, 137, 0),
|
|
246
|
+
'info': (42, 161, 152),
|
|
247
|
+
'accent': (211, 54, 130),
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
# Register and use
|
|
251
|
+
ThemeManager.register(SolarizedTheme)
|
|
252
|
+
theme = ThemeManager.load('solarized-dark')
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
## Runtime Theme Switching
|
|
256
|
+
|
|
257
|
+
```python
|
|
258
|
+
import curses
|
|
259
|
+
from curses_themes import ThemeManager
|
|
260
|
+
|
|
261
|
+
def main(stdscr):
|
|
262
|
+
themes = ['dark', 'light', 'dracula', 'nord', 'borland']
|
|
263
|
+
current = 0
|
|
264
|
+
|
|
265
|
+
while True:
|
|
266
|
+
theme = ThemeManager.load(themes[current])
|
|
267
|
+
theme.apply(stdscr)
|
|
268
|
+
|
|
269
|
+
stdscr.clear()
|
|
270
|
+
stdscr.addstr(0, 0, f"Theme: {themes[current]}",
|
|
271
|
+
theme.colors.primary)
|
|
272
|
+
stdscr.addstr(2, 0, "Press 'n' for next, 'q' to quit")
|
|
273
|
+
|
|
274
|
+
key = stdscr.getch()
|
|
275
|
+
if key == ord('q'):
|
|
276
|
+
break
|
|
277
|
+
elif key == ord('n'):
|
|
278
|
+
current = (current + 1) % len(themes)
|
|
279
|
+
|
|
280
|
+
curses.wrapper(main)
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
## API Reference
|
|
284
|
+
|
|
285
|
+
### ThemeManager
|
|
286
|
+
|
|
287
|
+
- `ThemeManager.load(name)` - Load theme by name
|
|
288
|
+
- `ThemeManager.register(theme_class, name=None)` - Register custom theme
|
|
289
|
+
- `ThemeManager.list_themes()` - List available themes
|
|
290
|
+
|
|
291
|
+
### Theme
|
|
292
|
+
|
|
293
|
+
- `theme.apply(stdscr)` - Apply theme to screen
|
|
294
|
+
- `theme.colors.primary` - Primary color
|
|
295
|
+
- `theme.colors.success` - Success color
|
|
296
|
+
- `theme.colors.error` - Error color
|
|
297
|
+
- `theme.colors.warning` - Warning color
|
|
298
|
+
- `theme.colors.info` - Info color
|
|
299
|
+
- `theme.colors.accent` - Accent color
|
|
300
|
+
- `theme.draw_box(stdscr, y, x, height, width, title="")` - Draw themed box
|
|
301
|
+
|
|
302
|
+
## Examples
|
|
303
|
+
|
|
304
|
+
See the `examples/` directory for complete demonstrations:
|
|
305
|
+
|
|
306
|
+
- `basic_usage.py` - Simple theme demonstration
|
|
307
|
+
- `theme_switcher.py` - Interactive theme switching
|
|
308
|
+
- `dashboard.py` - Full TUI dashboard with themes
|
|
309
|
+
- `custom_theme.py` - Creating custom themes
|
|
310
|
+
|
|
311
|
+
## Contributing
|
|
312
|
+
|
|
313
|
+
Contributions welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
314
|
+
|
|
315
|
+
### Adding New Themes
|
|
316
|
+
|
|
317
|
+
1. Create theme class in `curses_themes/themes/your_theme.py`
|
|
318
|
+
2. Implement `get_color_map()` method
|
|
319
|
+
3. Optionally override `get_border_chars()`
|
|
320
|
+
4. Add tests in `tests/test_themes/test_your_theme.py`
|
|
321
|
+
5. Submit pull request
|
|
322
|
+
|
|
323
|
+
## Related Projects
|
|
324
|
+
|
|
325
|
+
- [curses-java](https://github.com/FlossWare/curses-java) - Java terminal UI library with themes (inspiration for this project)
|
|
326
|
+
- [Textual](https://github.com/Textualize/textual) - Modern Python TUI framework
|
|
327
|
+
- [Rich](https://github.com/Textualize/rich) - Rich terminal output library
|
|
328
|
+
|
|
329
|
+
## License
|
|
330
|
+
|
|
331
|
+
GPL-3.0 - See [LICENSE](LICENSE) file for details.
|
|
332
|
+
|
|
333
|
+
## Author
|
|
334
|
+
|
|
335
|
+
**FlossWare** - [https://github.com/FlossWare](https://github.com/FlossWare)
|
|
336
|
+
|
|
337
|
+
Inspired by the excellent [curses-java](https://github.com/FlossWare/curses-java) library.
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
# curses-themes
|
|
2
|
+
|
|
3
|
+
**Lightweight theme support for Python curses applications**
|
|
4
|
+
|
|
5
|
+
[](https://www.gnu.org/licenses/gpl-3.0)
|
|
6
|
+
[](https://www.python.org/downloads/)
|
|
7
|
+
[](https://codecov.io/gh/FlossWare/curses-themes)
|
|
8
|
+
[](https://github.com/FlossWare/curses-themes/actions/workflows/quality.yml)
|
|
9
|
+
[](https://github.com/FlossWare/curses-themes/actions/workflows/coverage.yml)
|
|
10
|
+
|
|
11
|
+
Inspired by [FlossWare curses-java](https://github.com/FlossWare/curses-java), this library brings professional theme support to Python's standard `curses` module with zero external dependencies.
|
|
12
|
+
|
|
13
|
+
## Features
|
|
14
|
+
|
|
15
|
+
- 🎨 **8 Built-in Themes**: Modern, classic IDE, and retro computer themes
|
|
16
|
+
- 🔌 **Pluggable Architecture**: Easy custom theme creation
|
|
17
|
+
- 🎯 **Semantic Colors**: `primary`, `success`, `error`, `warning`, `info`
|
|
18
|
+
- 🔄 **Runtime Theme Switching**: Change themes on-the-fly
|
|
19
|
+
- 🖥️ **Terminal Aware**: Auto-detects 8/16/256 color support with fallbacks
|
|
20
|
+
- 📦 **Zero Dependencies**: Only uses Python standard library `curses`
|
|
21
|
+
- 🧪 **Thoroughly Tested**: Comprehensive test coverage
|
|
22
|
+
- 📚 **Well Documented**: API reference, examples, and guides
|
|
23
|
+
|
|
24
|
+
## Quick Start
|
|
25
|
+
|
|
26
|
+
```python
|
|
27
|
+
#!/usr/bin/env python3
|
|
28
|
+
import curses
|
|
29
|
+
from curses_themes import ThemeManager
|
|
30
|
+
|
|
31
|
+
def main(stdscr):
|
|
32
|
+
# Load and apply a theme
|
|
33
|
+
theme = ThemeManager.load('dracula')
|
|
34
|
+
theme.apply(stdscr)
|
|
35
|
+
|
|
36
|
+
# Use semantic colors
|
|
37
|
+
stdscr.addstr(0, 0, "Success!", theme.colors.success)
|
|
38
|
+
stdscr.addstr(1, 0, "Error!", theme.colors.error)
|
|
39
|
+
stdscr.addstr(2, 0, "Warning!", theme.colors.warning)
|
|
40
|
+
|
|
41
|
+
# Draw themed boxes
|
|
42
|
+
theme.draw_box(stdscr, 4, 2, 10, 40, title="My Panel")
|
|
43
|
+
|
|
44
|
+
stdscr.refresh()
|
|
45
|
+
stdscr.getch()
|
|
46
|
+
|
|
47
|
+
if __name__ == "__main__":
|
|
48
|
+
curses.wrapper(main)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Installation
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pip install curses-themes
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Or install from source:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
git clone https://github.com/FlossWare/curses-themes.git
|
|
61
|
+
cd curses-themes
|
|
62
|
+
pip install -e .
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Theme Gallery
|
|
66
|
+
|
|
67
|
+
### Modern Themes
|
|
68
|
+
|
|
69
|
+
<table>
|
|
70
|
+
<tr>
|
|
71
|
+
<td width="33%" align="center">
|
|
72
|
+
<img src="screenshots/default.png" width="300" alt="Default Theme"><br>
|
|
73
|
+
<strong>Default</strong><br>
|
|
74
|
+
Classic terminal aesthetic<br>
|
|
75
|
+
<em>Timeless</em>
|
|
76
|
+
</td>
|
|
77
|
+
<td width="33%" align="center">
|
|
78
|
+
<img src="screenshots/dark.png" width="300" alt="Dark Theme"><br>
|
|
79
|
+
<strong>Dark</strong><br>
|
|
80
|
+
Professional dark mode<br>
|
|
81
|
+
<em>Modern</em>
|
|
82
|
+
</td>
|
|
83
|
+
<td width="33%" align="center">
|
|
84
|
+
<img src="screenshots/light.png" width="300" alt="Light Theme"><br>
|
|
85
|
+
<strong>Light</strong><br>
|
|
86
|
+
High contrast for bright environments<br>
|
|
87
|
+
<em>Modern</em>
|
|
88
|
+
</td>
|
|
89
|
+
</tr>
|
|
90
|
+
</table>
|
|
91
|
+
|
|
92
|
+
### Retro Computer Themes
|
|
93
|
+
|
|
94
|
+
<table>
|
|
95
|
+
<tr>
|
|
96
|
+
<td width="50%" align="center">
|
|
97
|
+
<img src="screenshots/ti-99-4a.png" width="300" alt="TI-99/4A Theme"><br>
|
|
98
|
+
<strong>TI-99/4A</strong><br>
|
|
99
|
+
Texas Instruments home computer<br>
|
|
100
|
+
<em>1981-1984</em>
|
|
101
|
+
</td>
|
|
102
|
+
<td width="50%" align="center">
|
|
103
|
+
<img src="screenshots/trs-80.png" width="300" alt="TRS-80 Theme"><br>
|
|
104
|
+
<strong>TRS-80</strong><br>
|
|
105
|
+
Tandy/Radio Shack monochrome<br>
|
|
106
|
+
<em>1980-1983</em>
|
|
107
|
+
</td>
|
|
108
|
+
</tr>
|
|
109
|
+
</table>
|
|
110
|
+
|
|
111
|
+
### Business Software Themes
|
|
112
|
+
|
|
113
|
+
<table>
|
|
114
|
+
<tr>
|
|
115
|
+
<td width="33%" align="center">
|
|
116
|
+
<img src="screenshots/dos.png" width="300" alt="DOS Theme"><br>
|
|
117
|
+
<strong>DOS</strong><br>
|
|
118
|
+
Classic MS-DOS interface<br>
|
|
119
|
+
<em>1981-1995</em>
|
|
120
|
+
</td>
|
|
121
|
+
<td width="33%" align="center">
|
|
122
|
+
<img src="screenshots/dbase-iii.png" width="300" alt="dBASE III Theme"><br>
|
|
123
|
+
<strong>dBASE III</strong><br>
|
|
124
|
+
Iconic database software<br>
|
|
125
|
+
<em>1984-1985</em>
|
|
126
|
+
</td>
|
|
127
|
+
<td width="33%" align="center">
|
|
128
|
+
<img src="screenshots/dbase-iv.png" width="300" alt="dBASE IV Theme"><br>
|
|
129
|
+
<strong>dBASE IV</strong><br>
|
|
130
|
+
Windowed database interface<br>
|
|
131
|
+
<em>1988-1993</em>
|
|
132
|
+
</td>
|
|
133
|
+
</tr>
|
|
134
|
+
</table>
|
|
135
|
+
|
|
136
|
+
### 3D Effect Themes
|
|
137
|
+
|
|
138
|
+
<table>
|
|
139
|
+
<tr>
|
|
140
|
+
<td width="50%" align="center">
|
|
141
|
+
<img src="screenshots/borland-3d.png" width="300" alt="Borland 3D Theme"><br>
|
|
142
|
+
<strong>Borland 3D</strong><br>
|
|
143
|
+
Turbo Vision 3D look<br>
|
|
144
|
+
<em>1990-1997</em>
|
|
145
|
+
</td>
|
|
146
|
+
<td width="50%" align="center">
|
|
147
|
+
<img src="screenshots/dbase-iv-3d.png" width="300" alt="dBASE IV 3D Theme"><br>
|
|
148
|
+
<strong>dBASE IV 3D</strong><br>
|
|
149
|
+
3D windowed database UI<br>
|
|
150
|
+
<em>1988-1993</em>
|
|
151
|
+
</td>
|
|
152
|
+
</tr>
|
|
153
|
+
</table>
|
|
154
|
+
|
|
155
|
+
### Theme Comparison
|
|
156
|
+
|
|
157
|
+
| Theme | Era | Style | Colors | Best For |
|
|
158
|
+
|-------|-----|-------|--------|----------|
|
|
159
|
+
| Default | Timeless | Minimal | B/W | Universal compatibility |
|
|
160
|
+
| Dark | Modern | Professional | Blues/Greens | Low-light coding |
|
|
161
|
+
| Light | Modern | Clean | High contrast | Bright environments |
|
|
162
|
+
| TI-99/4A | 1981-1984 | Retro | Cyan/Blue | Nostalgia, gaming UIs |
|
|
163
|
+
| TRS-80 | 1980-1983 | Monochrome | White/Black | Authentic retro feel |
|
|
164
|
+
| DOS | 1981-1995 | Classic | White/Yellow | System utilities |
|
|
165
|
+
| dBASE III | 1984-1985 | Business | Cyan menus | Database applications |
|
|
166
|
+
| dBASE IV | 1988-1993 | Windowed | Blue background | Modern database UIs |
|
|
167
|
+
| Borland 3D | 1990-1997 | 3D Effect | Gray/Blue shadows | IDE-style applications |
|
|
168
|
+
| dBASE IV 3D | 1988-1993 | 3D Windowed | Blue with depth | Sophisticated database UIs |
|
|
169
|
+
|
|
170
|
+
## Creating Custom Themes
|
|
171
|
+
|
|
172
|
+
```python
|
|
173
|
+
from curses_themes import Theme, ThemeManager
|
|
174
|
+
|
|
175
|
+
class SolarizedTheme(Theme):
|
|
176
|
+
"""Solarized Dark theme"""
|
|
177
|
+
|
|
178
|
+
def __init__(self):
|
|
179
|
+
super().__init__(
|
|
180
|
+
name="Solarized Dark",
|
|
181
|
+
description="Precision colors for machines and people",
|
|
182
|
+
author="Ethan Schoonover"
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
def get_color_map(self):
|
|
186
|
+
return {
|
|
187
|
+
'background': (0, 43, 54),
|
|
188
|
+
'foreground': (131, 148, 150),
|
|
189
|
+
'primary': (38, 139, 210),
|
|
190
|
+
'success': (133, 153, 0),
|
|
191
|
+
'error': (220, 50, 47),
|
|
192
|
+
'warning': (181, 137, 0),
|
|
193
|
+
'info': (42, 161, 152),
|
|
194
|
+
'accent': (211, 54, 130),
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
# Register and use
|
|
198
|
+
ThemeManager.register(SolarizedTheme)
|
|
199
|
+
theme = ThemeManager.load('solarized-dark')
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## Runtime Theme Switching
|
|
203
|
+
|
|
204
|
+
```python
|
|
205
|
+
import curses
|
|
206
|
+
from curses_themes import ThemeManager
|
|
207
|
+
|
|
208
|
+
def main(stdscr):
|
|
209
|
+
themes = ['dark', 'light', 'dracula', 'nord', 'borland']
|
|
210
|
+
current = 0
|
|
211
|
+
|
|
212
|
+
while True:
|
|
213
|
+
theme = ThemeManager.load(themes[current])
|
|
214
|
+
theme.apply(stdscr)
|
|
215
|
+
|
|
216
|
+
stdscr.clear()
|
|
217
|
+
stdscr.addstr(0, 0, f"Theme: {themes[current]}",
|
|
218
|
+
theme.colors.primary)
|
|
219
|
+
stdscr.addstr(2, 0, "Press 'n' for next, 'q' to quit")
|
|
220
|
+
|
|
221
|
+
key = stdscr.getch()
|
|
222
|
+
if key == ord('q'):
|
|
223
|
+
break
|
|
224
|
+
elif key == ord('n'):
|
|
225
|
+
current = (current + 1) % len(themes)
|
|
226
|
+
|
|
227
|
+
curses.wrapper(main)
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## API Reference
|
|
231
|
+
|
|
232
|
+
### ThemeManager
|
|
233
|
+
|
|
234
|
+
- `ThemeManager.load(name)` - Load theme by name
|
|
235
|
+
- `ThemeManager.register(theme_class, name=None)` - Register custom theme
|
|
236
|
+
- `ThemeManager.list_themes()` - List available themes
|
|
237
|
+
|
|
238
|
+
### Theme
|
|
239
|
+
|
|
240
|
+
- `theme.apply(stdscr)` - Apply theme to screen
|
|
241
|
+
- `theme.colors.primary` - Primary color
|
|
242
|
+
- `theme.colors.success` - Success color
|
|
243
|
+
- `theme.colors.error` - Error color
|
|
244
|
+
- `theme.colors.warning` - Warning color
|
|
245
|
+
- `theme.colors.info` - Info color
|
|
246
|
+
- `theme.colors.accent` - Accent color
|
|
247
|
+
- `theme.draw_box(stdscr, y, x, height, width, title="")` - Draw themed box
|
|
248
|
+
|
|
249
|
+
## Examples
|
|
250
|
+
|
|
251
|
+
See the `examples/` directory for complete demonstrations:
|
|
252
|
+
|
|
253
|
+
- `basic_usage.py` - Simple theme demonstration
|
|
254
|
+
- `theme_switcher.py` - Interactive theme switching
|
|
255
|
+
- `dashboard.py` - Full TUI dashboard with themes
|
|
256
|
+
- `custom_theme.py` - Creating custom themes
|
|
257
|
+
|
|
258
|
+
## Contributing
|
|
259
|
+
|
|
260
|
+
Contributions welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
261
|
+
|
|
262
|
+
### Adding New Themes
|
|
263
|
+
|
|
264
|
+
1. Create theme class in `curses_themes/themes/your_theme.py`
|
|
265
|
+
2. Implement `get_color_map()` method
|
|
266
|
+
3. Optionally override `get_border_chars()`
|
|
267
|
+
4. Add tests in `tests/test_themes/test_your_theme.py`
|
|
268
|
+
5. Submit pull request
|
|
269
|
+
|
|
270
|
+
## Related Projects
|
|
271
|
+
|
|
272
|
+
- [curses-java](https://github.com/FlossWare/curses-java) - Java terminal UI library with themes (inspiration for this project)
|
|
273
|
+
- [Textual](https://github.com/Textualize/textual) - Modern Python TUI framework
|
|
274
|
+
- [Rich](https://github.com/Textualize/rich) - Rich terminal output library
|
|
275
|
+
|
|
276
|
+
## License
|
|
277
|
+
|
|
278
|
+
GPL-3.0 - See [LICENSE](LICENSE) file for details.
|
|
279
|
+
|
|
280
|
+
## Author
|
|
281
|
+
|
|
282
|
+
**FlossWare** - [https://github.com/FlossWare](https://github.com/FlossWare)
|
|
283
|
+
|
|
284
|
+
Inspired by the excellent [curses-java](https://github.com/FlossWare/curses-java) library.
|