An application to easily pick a color in Mac OS X and get the hex value
OS X comes with DigitalColor Meter:
Applications > Utilities > DigitalColor Meter.app
It has many options and preferences.
command+shift+c will copy the color under the cursor to the clipboard in many different formats.
The Mac OS X color picker is extensible.
Use Hex Color Picker to add a tab that provides you the configured color in hexadecimal RGB.
Just run e.g. TextEdit and press Cmd-Shift-C
to open the color picker, or run your standalone program.
An even more versatile color picker is Developer Color Picker with many different output formats, one of which is hexadecimal.
This is easily done with AppleScript. A complete working example of code is available here.