jellyfish-web/src/scripts/autoThemes.js

17 lines
754 B
JavaScript

import * as userSettings from './settings/userSettings';
import * as webSettings from './settings/webSettings';
import skinManager from './themeManager';
import { Events } from 'jellyfin-apiclient';
import ServerConnections from '../components/ServerConnections';
// Set the default theme when loading
skinManager.setTheme(userSettings.theme())
/* this keeps the scrollbar always present in all pages, so we avoid clipping while switching between pages
that need the scrollbar and pages that don't.
*/
.then(() => document.body.classList.add('force-scroll'));
// set the saved theme once a user authenticates
Events.on(ServerConnections, 'localusersignedin', function (e, user) {
skinManager.setTheme(userSettings.theme());
});