Use javascript to add night mode to web pages_javascript tips
HTML CSS:
Then use JavaScript to write a night mode plus:
<script><br>var brightness;<br>//Display mask<br>function cover(brightness) {<br> if (typeof(div) == 'undefined') {<br> div = document. createElement('div');<br> div.setAttribute('style', 'position:fixed;top:0;left:0;outline:5000px solid;z-index:99999;');<br> document. body.appendChild(div);<br> } else {<br> div.style.display = '';<br> }<br> div.style.outlineColor = 'rgba(0,0,0,' brightness ' )';<br>}<br>//Event listening<br>window.addEventListener('keydown', function(e) {<br> if (e.altKey && e.keyCode == 90) { //Alt Z: Turn on night mode <br> cover(brightness = 0.3);<br> }<br> if (e.altKey && e.keyCode == 88) { //Alt X: Turn off <br> cover(brightness = 0 ; <br> }<br> if (e.altKey && e.keyCode == 40) { //Alt ↓:Reduce brightness<br> if (brightness 0.05 < 0.95) cover(brightness = 0.05);<BR> } <BR>}, false);<BR></script>
It can also be written as a GreaseMonkey script and used as a browser extension to add night mode to any page

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

How to send web pages to the desktop as a shortcut in Edge browser? Many of our users want to display frequently used web pages on the desktop as shortcuts for the convenience of directly opening access pages, but they don’t know how to do it. In response to this problem, the editor of this issue will share the solution with the majority of users. , let’s take a look at the content shared in today’s software tutorial. The shortcut method of sending web pages to the desktop in Edge browser: 1. Open the software and click the "..." button on the page. 2. Select "Install this site as an application" in "Application" from the drop-down menu option. 3. Finally, click it in the pop-up window

Some netizens found that when they opened the browser web page, the pictures on the web page could not be loaded for a long time. What happened? I checked that the network is normal, so where is the problem? The editor below will introduce to you six solutions to the problem that web page images cannot be loaded. Web page images cannot be loaded: 1. Internet speed problem The web page cannot display images. It may be because the computer's Internet speed is relatively slow and there are more softwares opened on the computer. And the images we access are relatively large, which may be due to loading timeout. As a result, the picture cannot be displayed. You can turn off the software that consumes more network speed. You can go to the task manager to check. 2. Too many visitors. If the webpage cannot display pictures, it may be because the webpages we visited were visited at the same time.

The browser cannot open the web page but the network is normal. There are many possible reasons. When this problem occurs, we need to investigate step by step to determine the specific cause and solve the problem. First, determine whether the webpage cannot be opened is limited to a specific browser or whether all browsers cannot open the webpage. If only one browser cannot open the web page, you can try to use other browsers, such as Google Chrome, Firefox, etc., for testing. If other browsers are able to open the page correctly, the problem is most likely with that specific browser, possibly

Baidu Tieba is a very popular interactive platform that many people use to exchange experiences with like-minded people. Nowadays, we use mobile phones very frequently, and Baidu Tieba Android version has become one of the must-have applications in many people’s mobile phones. However, recently many users have reported that the font size of Baidu Tieba Android version is too small, so how should we solve this problem? In addition, when using the Android version of Baidu Tieba at night, how to set up night mode to protect eyesight? How to solve the problem that the font size of Baidu Tieba on Android is too small? When browsing posts using Baidu Tieba, if you feel that the font is too small, you can click on the three dots in the upper right corner to find the option to adjust the text size and adjust it according to your personal needs. How to set the night mode of Baidu Tieba for Android? In the menu interface, still

How to solve the problem of web pages not opening With the rapid development of the Internet, people increasingly rely on the Internet to obtain information, communicate and entertain. However, sometimes we encounter the problem that the web page cannot be opened, which brings us a lot of trouble. This article will introduce you to some common methods to help solve the problem of web pages not opening. First, we need to determine why the web page cannot be opened. Possible reasons include network problems, server problems, browser settings problems, etc. Here are some solutions: Check network connection: First, we need

Executing PHP code in a web page requires ensuring that the web server supports PHP and is properly configured. PHP can be opened in three ways: * **Server environment:** Place the PHP file in the server root directory and access it through the browser. * **Integrated Development Environment: **Place PHP files in the specified web root directory and access them through the browser. * **Remote Server:** Access PHP files hosted on a remote server via the URL address provided by the server.

How to enable night mode in Baidu browser? The settings in Baidu Browser are very diverse, which can provide users with diverse Internet access modes and help users obtain the Internet environment that best suits them. When we use Baidu Browser, we can get a softer Internet environment by turning on night mode to reduce the burden on our eyes. If you also like to use this function, follow the editor to take a look at Baidu Browser. Night mode setting tutorial. How to enable night mode in Baidu Browser 1. Go to the [Baidu Browser] APP homepage and select [My] in the lower right corner; 2. Select [Settings] in the upper right corner; 3. Select the round button after [Night Mode] and wait. Just show blue.

How to set night mode on Baicizhan? Baicizhan is a very popular tool for learning English. The software provides users with a large number of learning topics and interesting learning methods. Users can choose the learning method that suits them according to their actual situation and effectively improve their English level. When we use this software at night, if we feel that the screen is too bright, we can set it to night mode and adjust it. How to set it up specifically? Interested friends, let’s take a look at the method explained by the editor. How to set up night mode on Baicizhan 1. Open Baicizhan, enter the sidebar, find settings, and click to enter. Both Android and iOS systems have the same location. Find "Master Bao Mode" in the settings, because the design of Master Bao from Baicizhan is very interesting, so
