Skip to main content
2 of 3
added 378 characters in body
Stefan
  • 5.4k
  • 26
  • 32

You guys are to fast for me ;)

My solution which is similar to's @cormullion:

hexToRGB[hex_String] :=Module[{RGB},
    RGB = StringCases[hex, 
       RegularExpression["^#(\\w{2})(\\w{2})(\\w{2})"] -> {"$1", "$2", 
        "$3"}] // Flatten;
    RGBColor[FromDigits[#, 16]/100 - 1 & /@ RGB]
]

Graphics[{hexToRGB["#A4A4A4"], Disk[]}]

P.S.: Things are not always just #000000 and #FFFFFF. It's mostly a varying of shades of #A4A4A4 :)

EDIT

PieChart of the sector angles proportional to {R, G, B}

hexToPiechart =PieChart3D @@ {ToExpression@#/255. & /@ (StringCases[#, 
    RegularExpression["^#(\\w{2})(\\w{2})(\\w{2})"] -> {"16^^$1", 
      "16^^$2", "16^^$3"}])} &;


hexToPiechart["#A4A4A4"]

enter image description here

Stefan
  • 5.4k
  • 26
  • 32