Skip to content

Instantly share code, notes, and snippets.

@fiveisprime
Created June 17, 2012 01:15
Show Gist options
  • Select an option

  • Save fiveisprime/2943060 to your computer and use it in GitHub Desktop.

Select an option

Save fiveisprime/2943060 to your computer and use it in GitHub Desktop.
Lion Color Picker
set chosenColor to choose color default color {65535, 65535, 65535}
set the formattedColor to my hex(chosenColor)
on hex(chosenColor)
set the hex_list to {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"}
set the hex_value to ""
repeat with i from 1 to the count of the chosenColor
set this_value to (item i of the chosenColor) div 256
set x to item ((this_value div 16) + 1) of the hex_list
set y to item (((this_value / 16 mod 1) * 16) + 1) of the hex_list
set the hex_value to (the hex_value & x & y) as string
end repeat
return ("#" & the hex_value)
end hex
set the clipboard to formattedColor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment