Created
July 14, 2025 20:35
-
-
Save dandrake/2ae230906f802aa112fc7d849b73c4cf to your computer and use it in GitHub Desktop.
phone screen night vision red flashlight app as a single HTML page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- | |
| You want to use your phone as a flashlight, but using the camera flash | |
| is (1) too bright, and (2) is white and is jarring at night if you want | |
| just a bit of dim light. | |
| So you want, say, a dim, red light. | |
| There are apps that turn your entire screen some color, but you don't | |
| need that. Just transfer this HTML page to your phone and load it up in | |
| a browser. You can adjust the brightness, and flip from shades of red to | |
| shades of gray. | |
| --> | |
| <!DOCTYPE html> | |
| <html> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
| <style> | |
| body { | |
| background-color: rgb(128, 0, 0); | |
| display: flex; | |
| flex-direction: column; | |
| align-items: center; | |
| justify-content: left; | |
| height: 100vh; | |
| margin: 0; | |
| color: rgb(0, 0, 128); | |
| font-family: Arial, sans-serif; | |
| } | |
| input[type="range"] { | |
| width: 80%; | |
| max-width: 300px; | |
| } | |
| label { | |
| font-size: 1.2em; | |
| } | |
| </style> | |
| <body> | |
| <label for="brightnessSlider">Brightness:</label> | |
| <input type="range" id="brightnessSlider" min="0" max="255" value="128" oninput="adjustBrightness(this.value)" /> | |
| <label for="colorMode">Gray Mode:</label> | |
| <input type="checkbox" id="colorMode" value="unchecked" onchange="adjustBrightness(document.getElementById('brightnessSlider').value)" /> | |
| <script> | |
| function adjustBrightness(value) { | |
| const isGrayMode = document.getElementById('colorMode').checked; | |
| const backgroundColor = isGrayMode ? | |
| `rgb(${value},${value},${value})` : | |
| `rgb(${value}, 0, 0)`; | |
| document.body.style.backgroundColor = backgroundColor; | |
| } | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment