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

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

问题描述

十六进制颜色值是否可能在浏览器之间显示不同?在网站上工作时,我一直注意到在 Chrome 和 Safari 之间预览时使用的红色有所不同.

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:版本 58.0.3029.110(64 位)
  • Safari:版本 10.1.1 (12603.2.4)
  • MacOS Sierra:版本 10.12.5 (16F73)
  • iMac(Retina 5K,27 英寸,2014 年末)

代码:

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

</head>
<body>


</body>
</html>

颜色对比截图:左:铬
右:Safari

Color comparison screenshot: Left: Chrome
Right: Safari

怎么了?

推荐答案

这是因为 Safari 可以访问您显示器的 ICC 配置文件,并且它将使用它来提供 sRGB 中的最佳对应.

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.

在 Mac 上,您可以使用应用程序 > 实用程序中的 DigitalColor Meter 实用程序进行检查.将其设置为 Display in sRGB 以查看测量的颜色.Safari 将始终显示正确的 sRGB 颜色,而 Chrome 和 Firefox 将使用非标准 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.

如果您将显示器的颜色配置文件设置为标准的 sRGB,那么所有浏览器都会显示正确的值.

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

Safari 中没有设置使其表现得像其他人一样,我也没有在 chrome 中找到方法;Firefox 有一些关于颜色管理的标志,但我认为它只是关于图像的嵌入式 ICC 配置文件,而不是显示器的.

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.

,

实际上 FF 的标​​志 gfx.color_management.XXXX 也适用于渲染的颜色,并将提供与 Safari 相同的行为.但是,设置它时似乎存在错误(例如,画布的 getImageData() 方法将返回显示的 sRGB 值,而不是已创作的 RGB 值).

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 和 Safari 的十六进制颜色显示不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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