Minor modification.
This commit is contained in:
parent
28b6e4cb74
commit
e73167ef5e
@ -2,6 +2,7 @@ import { NavigationMode, ProjectionMode } from '../engine/viewer/camera.js';
|
||||
import { RGBAColor, RGBColor } from '../engine/model/color.js';
|
||||
import { EdgeSettings } from '../engine/viewer/viewermodel.js';
|
||||
import { CookieGetBoolVal, CookieGetRGBColorVal, CookieGetIntVal, CookieGetStringVal, CookieSetBoolVal, CookieSetRGBColorVal, CookieSetIntVal, CookieSetStringVal, CookieSetRGBAColorVal, CookieGetRGBAColorVal } from './cookiehandler.js';
|
||||
import { GetPreferredColorScheme } from './utils.js';
|
||||
|
||||
export const Theme =
|
||||
{
|
||||
@ -30,8 +31,7 @@ export class Settings
|
||||
|
||||
LoadFromCookies ()
|
||||
{
|
||||
const preferredColorScheme = window.matchMedia ('(prefers-color-scheme: dark)').matches ? Theme.Dark : Theme.Light;
|
||||
this.themeId = CookieGetIntVal ('ov_theme_id', preferredColorScheme);
|
||||
this.themeId = CookieGetIntVal ('ov_theme_id', GetPreferredColorScheme ());
|
||||
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));
|
||||
|
||||
@ -2,6 +2,7 @@ import { RGBColor, RGBColorToHexString } from '../engine/model/color.js';
|
||||
import { CreateObjectUrl } from '../engine/io/bufferutils.js';
|
||||
import { AddDiv, CreateDiv, AddDomElement } from '../engine/viewer/domutils.js';
|
||||
import { Loc } from '../engine/core/localization.js';
|
||||
import { Theme } from './settings.js';
|
||||
|
||||
export function GetNameOrDefault (originalName, defaultName)
|
||||
{
|
||||
@ -27,6 +28,11 @@ export function GetMaterialName (originalName)
|
||||
return GetNameOrDefault (originalName, Loc ('No Name'));
|
||||
}
|
||||
|
||||
export function GetPreferredColorScheme ()
|
||||
{
|
||||
return window.matchMedia ('(prefers-color-scheme: dark)').matches ? Theme.Dark : Theme.Light;
|
||||
}
|
||||
|
||||
export function IsHoverEnabled ()
|
||||
{
|
||||
return window.matchMedia ('(hover: hover)').matches;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user