Skip to main content
added 138 characters in body
Source Link
Dr. belisarius
  • 116.2k
  • 13
  • 205
  • 456

Also

rgb[x_] := RGBColor[FromDigits[#, 2] / 255 & /@ 
            Partition[IntegerDigits[FromDigits[StringDrop[x, 1], 16], 2, 24], 8]]

rgb@"#FF5500"

RGBColor[{255, 85, 0}]

Edit

Golfing a one liner :)

rgb[x_] := RGBColor[FromDigits[#, 16]/255 & /@ StringJoin /@ Partition[Rest@Characters@x, 2]]

Also

rgb[x_] := RGBColor[FromDigits[#, 2] & /@ 
            Partition[IntegerDigits[FromDigits[StringDrop[x, 1], 16], 2, 24], 8]]

rgb@"#FF5500"

RGBColor[{255, 85, 0}]

Also

rgb[x_] := RGBColor[FromDigits[#, 2] / 255 & /@ 
            Partition[IntegerDigits[FromDigits[StringDrop[x, 1], 16], 2, 24], 8]]

rgb@"#FF5500"

RGBColor[{255, 85, 0}]

Edit

Golfing a one liner :)

rgb[x_] := RGBColor[FromDigits[#, 16]/255 & /@ StringJoin /@ Partition[Rest@Characters@x, 2]]
Post Undeleted by Dr. belisarius
Post Deleted by Dr. belisarius
Source Link
Dr. belisarius
  • 116.2k
  • 13
  • 205
  • 456

Also

rgb[x_] := RGBColor[FromDigits[#, 2] & /@ 
            Partition[IntegerDigits[FromDigits[StringDrop[x, 1], 16], 2, 24], 8]]

rgb@"#FF5500"

RGBColor[{255, 85, 0}]