Skip to content

Commit

Permalink
feat: Use user color scheme by default if no cookie was found (#477)
Browse files Browse the repository at this point in the history
* feat: Use user color scheme by default if no cookie was found

* Update settings.js
  • Loading branch information
nikitaa01 authored Jun 17, 2024
1 parent 056b3f8 commit 28b6e4c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion source/website/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ export class Settings

LoadFromCookies ()
{
this.themeId = CookieGetIntVal ('ov_theme_id', Theme.Light);
const preferredColorScheme = window.matchMedia ('(prefers-color-scheme: dark)').matches ? Theme.Dark : Theme.Light;
this.themeId = CookieGetIntVal ('ov_theme_id', preferredColorScheme);
this.environmentMapName = CookieGetStringVal ('ov_environment_map', 'fishermans_bastion');
this.backgroundIsEnvMap = CookieGetBoolVal ('ov_background_is_envmap', false);
this.backgroundColor = CookieGetRGBAColorVal ('ov_background_color', new RGBAColor (255, 255, 255, 255));
Expand Down

0 comments on commit 28b6e4c

Please sign in to comment.