feat(theme): should have auto behaviour when theme option is empty

This commit is contained in:
Joxit 2023-03-17 07:58:26 +01:00
parent 6a8d984315
commit a8227d9cba
No known key found for this signature in database
GPG key ID: F526592B8E012263
2 changed files with 2 additions and 2 deletions

View file

@ -101,7 +101,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<li>
<a href="https://github.com/Joxit/docker-registry-ui/blob/main/LICENSE">License AGPL-3.0</a>
</li>
<li if="{ props.theme === 'auto' }">
<li if="{ props.theme === 'auto' || props.theme === '' }">
<material-switch
on-change="{ onThemeChange }"
checked="{ state.themeSwitch }"

View file

@ -34,7 +34,7 @@ const normalizeKey = (k) =>
.replace(/^theme-/, '');
const preferDarkMode = ({ theme }) => {
if (theme === 'auto') {
if (theme === 'auto' || theme === "") {
switch (localStorage.getItem(LOCAL_STORAGE_THEME)) {
case 'dark':
return true;