Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
287 views
in Technique[技术] by (71.8m points)

html - Hex colors display differently between Chrome and Safari on Mac

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>
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...