Hex transparency in colors

This question already has an answer here:

  • Understanding colors on Android (six characters) 6 answers

  • Here's a correct table of percentages to hex values. Eg for 50% white you'd use #80FFFFFF.

  • 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
  • (source)


    The problem can be solved generically by a cross multiplication

    How to calculate?


    hex values to percentage

    percentage = (value in decimal ) / 255 * 100

    What is the % transparency of B4 ? B4 in hex is 180.

    So 180 / 255 * 100 = 70,5 %

    percentage to hex values

    decimal = percentage / 100 * 255

    What is the hex of 80% ?

    80/100*255 = 204 . The hex value of 204 is CC


    I prefer to teach how to find the solution rather than handing table

    Give a man a fish and you feed him for a day; teach a man to fish and you feed him for a lifetime


    Color hexadecimal notation is like following: #AARRGGBB

  • A : alpha
  • R : red
  • G : green
  • B : blue
  • You should first look at how hexadecimal works. You can write at most FF.

    链接地址: http://www.djcxy.com/p/15270.html

    上一篇: 我们如何获得第三名

    下一篇: 六角形透明度的颜色