Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
rbga特定の 16 進カラー コードについて、a=0.97 でレンダリングされた色が最初の 16 進カラーと同じになるカラー コードに変換するにはどうすればよいですか?
rbga
言い換えれば、私が持っている場合、同じ色を静止画でレンダリングするが透明度を持つ同等のもの#cccを必要とします。rgba#ccc
#ccc
rgba
rgba に変換するには、次のようにする必要があります。
1- 16 進数のカラー コードを 3 つの部分に分割します
cccccc => cc(r)|cc(g)|cc(b)
2- 部分ごとに、parseInt を使用して int に変換します。
r = parseInt("cc", 16) g = parseInt("cc", 16) b = parseInt("cc", 16)
3-最終的なrgbaコードに必要なアルファ値を追加します