How refact0r/midnight-discord works
Project type and purpose
• This is an open-source, static asset “theme generator” for Discord (a CSS-based dark theme).
• It provides:
• A modular CSS source (in /src)
• A Node.js build/dev pipeline (scripts/dev.js)
• Pre-built and archived themes (build/, themes/, archive/)
File structure
• Top level:
• scripts/ – dev script for watching/combining CSS
• build/ – the compiled production CSS (midnight.css)
• themes/ – distributable .theme.css files (main + flavors)
• archive/ – historical theme versions and flavor experiments
• assets/ – images used in README previews
• package.json & scripts/dev.js – Node.js-based watcher & bundler
• .env support for local dev output paths
• Patterns:
• Modular CSS → concatenation/build step
• Single build pipeline controlled by Node.js/npm run dev
• Flavor override files layering on top of core theme
Key components
a. Source layer
• CSS modules (/src/*.css)
• Core theme file (themes/midnight.theme.css)
• Flavor files (themes/flavors/*.theme.css)
b. Build pipeline
• scripts/dev.js watcher
• Node.js (npm) environment
• .env for DEV_OUTPUT_PATH
c. Output artifacts
• /build/midnight.css (compiled)
• /themes/*.theme.css (packaged for distribution)
• Local dev output to Discord theme folders
d. Consumers / Distribution
• Discord clients (BetterDiscord, Vencord, any CSS-importing client)
• GitHub Pages (hosting https://refact0r.github.io/midnight-discord/build/midnight.css)
• End users dragging .theme.css into theme folders
Relationships & data flow
1. Developer edits /src or core theme file
2. scripts/dev.js (Node.js) watches filesystem → on change, it:
• Merges modules → produces /build/midnight.css
• Injects output into local client path (if .env set)
3. Build artifact is committed or served via GH Pages
4. End user installs by:
• Downloading .theme.css from themes/ or GH Pages
• Importing into Discord client theme directory
5. Flavor files apply variable overrides at runtime
Architectural patterns & principles
• Modular design: break theme into discrete CSS concerns
• Single responsibility: dev script only handles I/O and concatenation
• Extensibility: flavors layer on top of core; archive for fallback
• Zero-runtime overhead beyond static CSS (no JS in client)
Technologies & frameworks
• Node.js & npm (dev environment)
• Chokidar or fs.watch (inside scripts/dev.js)
• CSS variables for theming
• GitHub Pages (static hosting)
• Discord client theme import feature