Back

The "web app" that fits within a tweet

Last Edited: Edit this post on GitHub

This is a "web app" (it's actually just a tiny HTML fragment with a little bit of JavaScript but whatever) that fits entirely within a tweet (<=280 characters; in the final version).

It's a little script that flips the viewport's color between black and white to illuminate the screen and use it as a weak light source.

The original authors of this "app" can be found in this Hacker News thread. I merely modified it a bit to make it more user-friendly and compressed.

The code

Easier to understand:

data:text/html;charset=utf-8,<!DOCTYPE html><title>Screen Light</title><html onclick=on=!on;this.style.background=on%3F'white':'black';this.style.color=on%3F'black':'white'><body onload=on=true><h1>Screen Light</h1><p>Turn your screen into a light source<br>Tap to toggle<p><a href=https:/news.ycombinator.com/item?id=19069487>Source

Chrome only (but shorter):

data:text/html,<title>Screen Light</title><body onload=o=1 onclick=o=!o;style.background=o%3F'':'black';style.color=o%3F'':'white'><h1>Screen Light</h1><p>Turn your screen into a light source<br>Tap to toggle<p><a href=https:/news.ycombinator.com/item?id=19069487>Source

Final:

data:text/html,<title>Screen Light</title><html onclick=o=!o;style.background=o%3F0:'black';style.color=o%3F0:'white'><body onload=o=1><h1>Screen Light</h1><p>Turn your screen into a light source<br>Tap to toggle<p><a href=https:/news.ycombinator.com/item?id=19069487>Source

Installation

Just copy and paste the data URI into your browser's address bar.

You can also bookmark it to have it "downloaded". Note that data URIs always work offline.