Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use JavaScript to measure how bright a users monitor is?

I've noticed that the brightness of computer monitors drastically varies between computers.

As such, this changes the look of web pages greatly.

Is there a way to use JavaScript to automatically detect how bright (or dark) a users monitor is so that I can adjust my web page colors accordingly?

UPDATE

Please note that I do not want manual user involvement. I want this detection to be automatic so that users don't realize I dynamically change the color palette automatically based on the brightness/darkness of their monitor.

UPDATE 2

Please also note that I'm not talking about wanting to adjust/calibrate the end users actual monitor but instead, programatically adjust the color selected to be displayed on the web-page itself. Meaning, if the end user has a darker than normal (brightness) display, I'll instead display a version of my web page that uses brighter colors instead.

like image 541
HankV Avatar asked May 21 '10 15:05

HankV


2 Answers

There's no way to do this programatically. What you'd need to do is write some sort of monitor calibration test, possibly using variations of images like these, showing the user two or more images and asking them to chose the one which looks closer, adjusting colors each time they make a choice, until you feel the changes you've made are accurate.

EDIT: Basically I'm suggesting building something like this.

like image 98
Josh Avatar answered Oct 07 '22 14:10

Josh


Most of the brightness/darkness settings are a function of the monitor. Nothing in the computer (let alone JavaScript running in a sandbox) is able to access this kind of information - it's mainly a one-way data flow between computer and monitor. Factors such as brightness of the room, and whether there is light behind the monitor will influence the appearance of the screen just as much.

There's no way to get everyone to see your website the way you see it. The sooner you realise that, the easier your life will be.

like image 45
Skilldrick Avatar answered Oct 07 '22 14:10

Skilldrick