3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

#rrggbbaaのaaを10進数にする

Last updated at Posted at 2016-10-01

#rrggbbaaiOS10 (Safari 10.0) が対応したらしい。

# 0000ffcc //rgb(0 0 100% / 80%)

みたいなやつ。HEXに不透明度がつく。

ただ、不透明度も16進数で書かないといけない。
でも、デザインデータは0〜100%の不透明度でやってきますよね。

計算

なので、10進数/16進数対応表を参考にaaを%にする数字をわりだした。
小数点.19608とか余ってしまうんだけど、それは誤差ということで。

10進数 / 255 * 100

結果

  • 10% 1A
  • 20% 33
  • 30% 4D
  • 40% 66
  • 50% 80
  • 60% 99
  • 70% B3
  • 80% CC
  • 90% E6

うむ。これは覚えられない。

結論

RGBaでいいかな。
Sublime Text の In-Dec-Value とか使ってると HEX と RGBa をすぐ変換できるし、その方が楽。

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?