2017-09-08 15 views
2

color: rgb(51, 51, 51);, color: #333333color: black; opacity: 0.8;이 회색 음영을 생성한다는 것을 발견했습니다. 어떻게 일반화 할 수 있습니까?회색조 - 검정색 불투명도 변환

즉, 임의의 RGB 또는 HEX 색/회색 음영이 주어진 경우 의 해당 값을 어떻게 결정할 수 있습니까? color: black;?

Here is the Codepen Demo.

<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> 
+1

이 https://www.viget.com/articles/에서보세요 값 동등한 색상 및 투명성 –

답변

1

당신은 너무이 Hextool 사이트를 사용할 수 있습니다. RGBA을 사용하십시오. 네 번째 값은 해당 색상의 불투명도입니다.

예는 : -

rgba(51, 51, 51, 0.87) 

87 % 불투명도

진수 불투명도

100% — FF 
95% — F2 
90% — E6 
85% — D9 
80% — CC 
75% — BF 
70% — B3 
65% — A6 
60% — 99 
55% — 8C 
50% — 80 
45% — 73 
40% — 66 
35% — 59 
30% — 4D 
25% — 40 
20% — 33 
15% — 26 
10% — 1A 
5% — 0D 
0% — 00