diff --git a/static/js/grey.js b/static/js/grey.js new file mode 100644 index 0000000000000000000000000000000000000000..4ce560253146c2665993e53991a6bd12169c129c --- /dev/null +++ b/static/js/grey.js @@ -0,0 +1,26 @@ +var global_grey = { + '-webkit-filter':'grayscale(1)', + '-moz-filter':'grayscale(1)', + '-ms-filter':'grayscale(1)', + '-o-filter':'grayscale(1)', + 'filter':'grayscale(1)', +}; + +function autoGreyByTime(){ + let now = new Date(); + let now_hours = now.getHours(); + // console.log(now_hours,typeof now_hours); + if(now_hours >= 23 || now_hours < 8){ + $('html').css(global_grey); + } +} +autoGreyByTime(); + +function darkModeHandler() { + const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)'); + if (mediaQuery.matches) { + let color = '#1b1b1b'; + $('body').css({"background": color }); + } +} +darkModeHandler(); \ No newline at end of file diff --git a/templates/admin.html b/templates/admin.html index 70fbbe75ebffee62b89bfc3de8aa599b72453732..267a75b528c29385efe5773574b49400859d17d7 100644 --- a/templates/admin.html +++ b/templates/admin.html @@ -8,10 +8,10 @@ - +
- + + @@ -19,14 +20,6 @@