Skip to main content
deleted 31 characters in body
Source Link

You guys are totoo fast for me ;)

My solution which is similar to's @cormullionto @cormullion's:

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#000000 and #FFFFFF#FFFFFF. It's mostly a varying of shades of #A4A4A4 #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 herepie chart

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

You guys are too fast for me ;)

My solution which is similar to @cormullion's:

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 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"]

pie chart

added 378 characters in body
Source Link
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

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 :)

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

Source Link
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 :)