mirror of
https://github.com/primefaces/primevue.git
synced 2025-05-09 08:52:34 +00:00
Cosmetics
This commit is contained in:
parent
9b0f1ac98a
commit
9a07a0b42c
2 changed files with 9 additions and 19 deletions
|
@ -84,21 +84,17 @@ export default {
|
|||
return options;
|
||||
},
|
||||
applyColorScheme(options = {}, currentColorScheme, defaults) {
|
||||
if (options.colorScheme) {
|
||||
const colorSchemeOption = this.getColorSchemeOption(options.colorScheme, defaults);
|
||||
const isClient = SharedUtils.dom.isClient();
|
||||
const isAuto = !colorSchemeOption.light?.default && !colorSchemeOption.dark?.default;
|
||||
const isDark = isAuto && isClient ? window.matchMedia('(prefers-color-scheme: dark)').matches : colorSchemeOption.dark?.default;
|
||||
const defaultDocument = isClient ? window.document : undefined;
|
||||
const colorSchemeOption = this.getColorSchemeOption(options.colorScheme, defaults);
|
||||
const isClient = SharedUtils.dom.isClient();
|
||||
const isAuto = !colorSchemeOption.light?.default && !colorSchemeOption.dark?.default;
|
||||
const isDark = isAuto && isClient ? window.matchMedia('(prefers-color-scheme: dark)').matches : colorSchemeOption.dark?.default;
|
||||
const defaultDocument = isClient ? window.document : undefined;
|
||||
|
||||
if (isDark && defaultDocument) {
|
||||
SharedUtils.dom.addClass(defaultDocument.documentElement, colorSchemeOption.dark?.class);
|
||||
}
|
||||
|
||||
return isDark ? 'dark' : 'light';
|
||||
if (isDark && defaultDocument) {
|
||||
SharedUtils.dom.addClass(defaultDocument.documentElement, colorSchemeOption.dark?.class);
|
||||
}
|
||||
|
||||
return currentColorScheme;
|
||||
return isDark ? 'dark' : 'light';
|
||||
},
|
||||
toggleColorScheme(options = {}, currentColorScheme, defaults) {
|
||||
const newColorScheme = currentColorScheme === 'dark' ? 'light' : 'dark';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue