Skip to content
This repository has been archived by the owner on Jan 19, 2023. It is now read-only.

Commit

Permalink
Use system theme by default
Browse files Browse the repository at this point in the history
Signed-off-by: Milan Klanjsek <mklanjsek@pivotal.io>
  • Loading branch information
mklanjsek committed Oct 26, 2020
1 parent e0cdf04 commit ab1a086
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion web/src/app/modules/shared/services/theme/theme.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ export const lightTheme: Theme = {
assetPath: 'assets/css/clr-ui.min.css',
};

export const defaultTheme = lightTheme;
export const defaultTheme = window.matchMedia('(prefers-color-scheme:dark)')
.matches
? darkTheme
: lightTheme;

@Injectable({
providedIn: 'root',
Expand All @@ -53,6 +56,7 @@ export class ThemeService implements OnDestroy {

const themeType = localStorage.getItem('theme') as ThemeType;
this.themeType = themeType || defaultTheme.type;

this.renderer = rendererFactory.createRenderer(null, null);

this.storageEventHandler = (e: StorageEvent): void => {
Expand Down

0 comments on commit ab1a086

Please sign in to comment.