$ show ssnangua/ColorTxt
ColorTxt (åŊŠč¯ģ) is a cross-platform desktop ebook reader built with Electron, Vue 3, and Monaco Editor. It focuses on reading local text/ebook files (TXT, EPUB, PDF, MOBI, FB2, CHM) with an extensive feature set: AI-powered reading assistant (chat, RAG, mindmap, wordcloud, character card generation), multi-engine text-to-speech (Edge, MiniMax, DashScope, MiMo, Volcengine, Windows SAPI), dictionary lookup supporting multiple formats (StarDict, MDict, Babylon, DICT), a book source engine fully compatible with Legado (é č¯ģ) for searching and downloading web novels, WebDAV sync for cross-device backup, and deep customization of reading appearance (themes, fonts, line spacing, backgrounds, reading ruler, pomodoro timer). The architecture follows a standard Electron pattern: a main process handles I/O, AI, TTS, networking, and IPC, while separate renderer processes (main reader, find-book, stealth reader) are Vue 3 SPAs communicating via typed IPC through a preload bridge. The codebase is large and feature-rich, demonstrating solid engineering practices (composable patterns, shared type libraries, clean IPC design) but also carries maintenance complexity from the Legado compatibility layer, numerous third-party API integrations, and platform-specific hacks for stealth mode and native modules.
The LLM identified 6 files worth highlighting for reuse:
Defines the `VoiceReadTtsProvider` interface with methods for voice listing, synthesis, and health checks. This abstraction is shared by all TTS engines (Edge, DashScope, MiniMax, MiMo, Volcengine, WinSAPI) and could be extracted to build a new TTS provider for a different project with minimal changes. Demonstates clean interface design and provider registration pattern.
Central dictionary service that orchestrates local dictionary readers (StarDict, BGL, MDict, DICT, Slob) and network providers (Wiktionary, Wikipedia). The format-specific readers are isolated, and the service handles caching, candidate generation, and fallback. Could be reused as a general dictionary lookup system for any language learning app.
Implements a lenient JSON parser that handles Legado-style non-standard JSON (single quotes, trailing commas, unquoted keys). This is a self-contained utility that could be reused in any project needing to parse 'loose' JSON from external sources (e.g., web scraping results). Demonstrates non-obvious parsing skill with regex-based corrections and type coercion.
A Vue composable that manages an anchored popover menu with auto-flip when near screen edges, dismissible overlay, and resize recalculation. It isolates all positioning logic in a clean composable that can be reused in any Vue 3 project needing context menus or tooltips. Demonstrates advanced DOM measurement and state management.
A generic modal stack implementation with z-index management, escape-to-close, and bring-to-front ordering. It is entirely decoupled from Vue and uses plain callbacks, making it portable to any UI framework. Solves the common modal overlap problem with a clean, reusable stack abstraction.
Provides a global dialog queue for alerts, confirms, and prompts. Uses a promise-based API and manages multiple dialog instances, stacking and matching promises correctly. This can be extracted into any Vue 3 project to replace native `alert()`/`confirm()` with a consistent customizable dialog system. Demonstrates clean service pattern with reactive state.