Created
October 6, 2025 18:30
-
-
Save stefanpejcic/e3ce1b8b12603667da7e9e43fd610da6 to your computer and use it in GitHub Desktop.
Script for OpenPanel UI startup: sets dark mode by default and disables user/system theme switching - https://openpanel.com/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| : ' | |
| Example script that executes on openpanel UI container startup: | |
| sets dark mode by default and disables user/system theme switching. | |
| ' | |
| base="/templates/base.html" | |
| switcher="/templates/partials/theme_switcher.html" | |
| # 1. delete theme switcher from the sidebar | |
| rm -rf ${switcher} | |
| # 2. remove inline code from `head` that handles the switch on page load | |
| sed -i '/THEME_SCRIPT_START/,/THEME_SCRIPT_END/ s/^/<!-- /; /THEME_SCRIPT_START/,/THEME_SCRIPT_END/ s/$/ -->/' ${base} | |
| # 3. OPTIONAL: set dark as the default | |
| sed -i 's|<html lang="en" class="h-full" style="color-scheme: "|<html lang="en" class="h-full" style="color-scheme: dark;|" ${base} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment