如何使用JavaScript来衡量用户监视器的亮度? [英] How to use JavaScript to measure how bright a users monitor is?

查看:53
本文介绍了如何使用JavaScript来衡量用户监视器的亮度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到计算机显示器的亮度在两台计算机之间大不相同.

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

因此,这极大地改变了网页的外观.

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

是否有一种使用JavaScript的方法来自动检测用户监视器的亮度(或暗度),以便我可以相应地调整网页颜色?

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?

更新

请注意,我不希望用户手动参与.我希望这种检测是自动的,以便用户不会意识到我会根据显示器的亮度/暗度自动更改调色板.

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.

更新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.

推荐答案

无法以编程方式执行此操作.您需要做的是编写某种监视器校准测试,可能使用此类图像的变体,向用户显示两张或更多图像,并要求他们选择看起来更近的图像,并在每次选择时调整颜色,直到您感觉所做的更改是准确的为止.

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.

基本上,我建议构建类似的内容.

Basically I'm suggesting building something like this.

这篇关于如何使用JavaScript来衡量用户监视器的亮度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆