A customizable BetterDiscord theme template built with SCSS, featuring automated build processes and local development workflow.
| I want to⦠| Go to |
|---|---|
| Get started quickly | Quick Start |
| Develop locally | Development Workflow |
| Customize colors and styles | Customization Guide |
| Deploy my theme | Deployment |
| Fix issues | Troubleshooting |
| Learn all commands | Available Scripts |
| Understand the file structure | Project Structure |
git clone https://github.com/yourusername/your-theme.git
cd your-theme
npm install
Copy the example environment file and customize it:
cp .env.example .env
Edit .env to configure your theme:
# Whether to allow automatic copying of the theme to BetterDiscord folder
ALLOW_THEME_COPY=false
# File names used in the build process
USER_FILE=example.theme.css
LOCAL_TEST_FILE=example.local.theme.css
COMPILED_FILE=compiled-theme.css
COMPILED_MIN_FILE=compiled-theme.min.css
Important: Set ALLOW_THEME_COPY=true only if you want automatic copying to your BetterDiscord themes folder during development.
Edit example.theme.css to set your theme metadata and variables:
/**
* @name Your Theme Name
* @description A customizable BetterDiscord theme
* @version 0.0.1
* @author Your Name
*/
Customize the CSS variables in the :root section to change colors, fonts, sizes, and effects.
npm run watch:local
This will:
ALLOW_THEME_COPY=true)npm run watch - Watch SCSS files and compile to CSSnpm run watch:local - Watch and build local test theme (recommended for development)npm run build - Build both expanded and minified versionsnpm run build:exp - Build expanded CSS onlynpm run build:min - Build minified CSS onlynpm run build:local - Build local test theme (includes CSS inline)npm run lint - Check JavaScript files for errorsnpm run lint:fix - Fix JavaScript linting errors automaticallynpm run format - Check code formattingnpm run format:fix - Fix code formatting automaticallybetterdiscord-theme-template/
βββ src/
β βββ modules/ # SCSS modules for different Discord components
β β βββ _variables.scss # Theme variables
β β βββ _colors.scss # Color definitions
β β βββ _fonts.scss # Font imports and definitions
β β βββ _backgrounds.scss # Background styling
β β βββ _discord-*.scss # Discord component styles
β β βββ _betterdiscord.scss # BetterDiscord specific styles
β β βββ _plugins.scss # Plugin compatibility styles
β βββ utils/ # Build utilities
β β βββ buildLocal.js # Local theme builder
β βββ config.js # Environment configuration
β βββ local-build.js # Local build script
β βββ local-watch.js # Local watch script
β βββ main.scss # Main SCSS entry point
βββ dist/ # Compiled output files
β βββ compiled-theme.css # Expanded compiled CSS
β βββ compiled-theme.min.css # Minified compiled CSS
β βββ example.local.theme.css # Local test theme (inline CSS)
βββ assets/ # Theme assets (fonts, images)
βββ example.theme.css # User-facing theme file (template)
βββ .env.example # Example environment configuration
βββ .prettierrc.js # Prettier configuration
βββ eslint.config.js # ESLint configuration
βββ package.json # Project dependencies and scripts
src/modules/npm run build to compile CSSdist/compiled-theme.css on GitHub Pages or a CDN@import URL in example.theme.cssexample.theme.css in BetterDiscordsrc/modules/npm run watch:localEdit src/modules/_colors.scss to change the color scheme:
:root {
--primary-color: #5865f2;
--secondary-color: #3ba55d;
// ... more colors
}
assets/fonts/src/modules/_fonts.scssEach Discord component has its own SCSS module in src/modules/:
_discord-sidebar.scss - Server list and navigation_discord-channels.scss - Channel list_discord-chat.scss - Main chat area_discord-members.scss - Member list_discord-userarea.scss - Bottom user area_discord-modals.scss - Popups and modalsEdit the relevant file to customize specific components.
Users can customize the theme without editing the .theme.css file directly by using BetterDiscordβs Custom CSS feature. This method is recommended because:
How to use Custom CSS:
Example Custom CSS:
/* Custom color scheme */
:root {
--primary-color: #ff6b6b; /* Change accent color to red */
--background-primary: #1a1a1a; /* Darker background */
--server-size: 56px; /* Larger server icons */
}
/* Optional: Enable custom background */
:root {
--use-custom-background: 1;
--custom-background: url("https://i.imgur.com/your-image.jpg");
--background-blur: 8px;
--background-opacity: 0.9;
}
Tips:
GitHub Pages provides free, reliable hosting for your themeβs CSS files.
main branch and / (root) foldernpm run build
dist folder:
git add dist/
git commit -m "Build theme for deployment"
git push origin main
Update your theme file:
Edit example.theme.css and update the @import URL to your GitHub Pages URL:
@import url("https://yourusername.github.io/your-theme-repo/dist/compiled-theme.css");
Your GitHub Pages URL format is: https://[username].github.io/[repository-name]/dist/compiled-theme.css
gh-pages branchFor a cleaner setup that keeps build files separate from your source code:
npm install --save-dev gh-pages
package.json:
{
"scripts": {
"deploy": "npm run build && gh-pages -d dist"
}
}
npm run deploy
gh-pages branchhttps://yourusername.github.io/your-theme-repo/compiled-theme.cssAlternative hosting options:
Automatically serves files from your GitHub repository:
@import url("https://cdn.jsdelivr.net/gh/yourusername/your-theme-repo@main/dist/compiled-theme.css");
Benefits:
@tag or @branchHost on your own web server:
npm run builddist/compiled-theme.css to your web server@import URL to your serverβs URLAccess-Control-Allow-Origin: *
Once hosted, distribute your theme:
git tag v1.0.0git push --tagsexample.theme.css (or your renamed version)npm run build%appdata%/BetterDiscord/themes/~/Library/Application Support/BetterDiscord/themes/~/.config/BetterDiscord/themes/Ctrl+R (Windows/Linux) or Cmd+R (macOS)node_modules and run npm install again.env are correctly namedCtrl+Shift+R (Windows/Linux) or Cmd+Shift+R (macOS)dist folder is committed to the repositoryThis project uses:
Pre-commit hooks will automatically:
git checkout -b feature-namenpm run lint:fix and npm run format:fixgit commit -m 'Add feature'git push origin feature-nameThis project is licensed under the MIT License - see the LICENSE file for details.
Note: This is a template. Remember to customize:
example.theme.css