Ich habe color: rgb(51, 51, 51);
, color: #333333
und color: black; opacity: 0.8;
äquivalente Grautöne gefunden. Wie kann ich das verallgemeinern?Umwandlung von Graustufen in Schwarz-Opazität
Mit anderen Worten, wie kann ich einen gegebenen Wert von opacity
bei einer beliebigen RGB- oder HEX-Farbe/Graustufen bestimmen, wenn color: black;
?
<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>
Werfen Sie einen Blick auf https://www.viget.com/articles/ Gleichsetzung von Farbe und Transparenz –