| 898 | |
| 899 | /* Get the actual system theme is user selected system theme in preferences */ |
| 900 | function parseSystemTheme(selectedTheme) { |
| 901 | if (selectedTheme === 'system') { |
| 902 | const systemMatchMedia = matchMedia('(prefers-color-scheme: dark)'); |
| 903 | return { |
| 904 | 'theme': systemMatchMedia.matches ? 'dark' : 'light', |
| 905 | 'systemMatchMedia': systemMatchMedia, |
| 906 | }; |
| 907 | } |
| 908 | return { |
| 909 | 'theme': selectedTheme, |
| 910 | 'systemMatchMedia': null, |
| 911 | }; |
| 912 | } |
| 913 | |
| 914 | /* Theme wrapper used by DOM containers to apply theme */ |
| 915 | /* In future, this will be moved to App container */ |