Mac和Chrome上的十六进制颜色显示不同 [英] Hex colors display differently between Chrome and Safari on Mac

查看:620
本文介绍了Mac和Chrome上的十六进制颜色显示不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

十六进制颜色值可能在浏览器中以不同的方式显示?在网站上工作时,我一直注意到在Chrome和Safari之间预览时使用的红色差异。


  • Chrome浏览器:版本58.0.3029.110(64位)

  • Safari:10.1.1版(12603.2.4)
  • MacOS Sierra:版本10.12.5(16F73)
    iMac(Retina 5K,27英寸,2014年末)
  • / li>


代码:

 <!DOCTYPE html>< html>< head> < title> Color Test< / title> < style type =text / css> body {height:200px; < / html>< / code>< / pre>< / div>< / style>< / head>< body><颜色比较屏幕截图:

左侧:Chrome

右侧:Safari



有什么不对?

解决方案

访问您的显示器的ICC配置文件,并且它将使用它来提供sRGB中的最佳通信。

在mac上,您可以使用您的Apps> Utilities中的DigitalColor Meter 实用程序进行检查。将其设置为以sRGB显示以查看测量的颜色。 Safari将始终显示正确的sRGB颜色,而Chrome和Firefox将以非标准sRGB颜色配置文件关闭。


$ b 如果您将显示器的颜色配置文件设置为标准sRGB,则所有浏览器都将显示正确的值。



Safari中没有设置使其像其他人一样行事,我也没有发现铬的方式; Firefox有一些关于色彩管理的标志,但我认为这只是关于图像的嵌入式ICC配置文件,而不是显示器的配置文件。 b

其实FF的标志 gfx.color_management.XXXX 也适用于渲染的颜色,并且会提供相同的行为作为Safari。但是,它似乎有设置它时的错误(例如canvas' getImageData()方法将返回显示的sRGB值而不是已创建的RGB值) p>

Is it possible for a hexadecimal color value to be displayed differently between browsers? While working on a site, I kept noticing a difference in a red that I was using when previewing between Chrome and Safari.

  • Chrome: Version 58.0.3029.110 (64-bit)
  • Safari: Version 10.1.1 (12603.2.4)
  • MacOS Sierra: Version 10.12.5 (16F73)
  • iMac (Retina 5K, 27-inch, Late 2014)

Code:

<!DOCTYPE html>
<html>
<head>
	<title>Color Test</title>
	<style type="text/css">
body {
	height: 200px;
	background-color: #ff3324;
}	
	</style>

</head>
<body>


</body>
</html>

Color comparison screenshot: Left: Chrome
Right: Safari

What's wrong?

解决方案

This is because Safari has access to your monitor's ICC profile, and that it will use it to provide the best correspondence in sRGB.

On mac, you can check it with the DigitalColor Meter utility you've got in you Apps > Utilities. Set it to Display in sRGB to see the colors measured. Safari will always display the correct sRGB color, while Chrome and Firefox will be off with an non standard sRGB color profile.

If you set your monitor's color profile to an standard sRGB one, then all browsers will show the correct values.

There is no setting in Safari to make it behave like others, and I didn't found a way in chrome either ; Firefox has some flags about color management, but I think it's only about images' embedded ICC profiles, not the monitor's one.

[edit],

Actually FF's flags gfx.color_management.XXXX do also apply to the rendered colors, and will provide the same behavior as Safari. But, it seems there are bugs when setting it (e.g canvas' getImageData() method will return the displayed sRGB values instead of the RGB ones that has been authored).

这篇关于Mac和Chrome上的十六进制颜色显示不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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