mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 09:32:06 +00:00
Automatic support for dark theme in Play interface
This commit is contained in:
parent
a714b82f9b
commit
149431ffc3
@ -534,6 +534,23 @@
|
||||
var theme = window.localStorage.getItem('theme');
|
||||
if (theme) {
|
||||
setColorTheme(theme);
|
||||
} else {
|
||||
/// Obtain system-level user preference
|
||||
var media_query_list = window.matchMedia('prefers-color-scheme: dark')
|
||||
|
||||
if (media_query_list.matches) {
|
||||
/// Set without saving to localstorage
|
||||
document.documentElement.setAttribute('data-theme', 'dark');
|
||||
}
|
||||
|
||||
/// There is a rumor that on some computers, the theme is changing automatically on day/night.
|
||||
media_query_list.addEventListener('change', function(e) {
|
||||
if (e.matches) {
|
||||
document.documentElement.setAttribute('data-theme', 'dark');
|
||||
} else {
|
||||
document.documentElement.setAttribute('data-theme', 'light');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
document.getElementById('toggle-light').onclick = function()
|
||||
|
Loading…
Reference in New Issue
Block a user