我已经发现了。
color: rgb(51, 51, 51);
并且
color: #333333;
并且
color: black; opacity: 0.8;
所有的产生的灰度色调都是等价的。
我该如何概括这个呢?
换句话说,给定任意一个RGB或HEX颜色/灰度级别,当使用color: black;
时,我怎样确定对应的opacity
值呢?
<style>
div {
font-family: sans-serif;
font-size: 48px;
margin: 20px;
padding: 60px;
}
.rgb {
color: rgb(51, 51, 51); /* given this value... */
}
.hex {
color: #333333; /* ...or given this value */
}
.opacity {
color: black;
opacity: 0.8; /* how can I determine this value? */
}
<style>
<body>
<div class="rgb">rgb(51, 51, 51)</div>
<div class="hex">hex #333333</div>
<div class="opacity">opacity 0.8</div>
</body>