Skip to content

Instantly share code, notes, and snippets.

@prcaen
Last active August 18, 2017 06:18
Show Gist options
  • Save prcaen/5466229 to your computer and use it in GitHub Desktop.
Save prcaen/5466229 to your computer and use it in GitHub Desktop.
Hex Opacity Values

Bash profile

alias alphahex='echo -n "Enter percentage: " ; read opt ; echo "obase=16; ibase=10; (255*$opt+50)/100" | bc'

Command

Replace XX by percentage.

echo "obase=16; ibase=10; (255*XX+50)/100" | bc

List

  • 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment