#import urllib
#from lxml import html

#url = "https://material-ui.com/customization/color/"
#page = html.fromstring(urllib.urlopen(url).read())

#colors={}

#for color in page.xpath("//*[@class='jss260']"):
#    colorName = color.xpath(".//*[@class='jss257']/text()")[0]
#    value = {}
#    for val in color.xpath(".//*[@class='jss259']"):
#        value[val.xpath("./span[1]/text()")[0]] = val.xpath("./span[2]/text()")[0]
#    colors[colorName]=value
#print(colors)

SVG="""<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->

<svg
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   version="1.1"
   id="svg2"
   xml:space="preserve"
   width="125"
   height="127.33333"
   viewBox="0 0 125 127.33333"
   sodipodi:docname="Redmine-Logo.svg"
   inkscape:version="0.92.4 (5da689c313, 2019-01-14)"><metadata
     id="metadata8"><rdf:RDF><cc:Work
         rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
     id="defs6" /><sodipodi:namedview
     pagecolor="#ffffff"
     bordercolor="#666666"
     borderopacity="1"
     objecttolerance="10"
     gridtolerance="10"
     guidetolerance="10"
     inkscape:pageopacity="0"
     inkscape:pageshadow="2"
     inkscape:window-width="1600"
     inkscape:window-height="881"
     id="namedview4"
     showgrid="false"
     inkscape:zoom="0.73268687"
     inkscape:cx="223.15126"
     inkscape:cy="63.666664"
     inkscape:window-x="0"
     inkscape:window-y="0"
     inkscape:window-maximized="1"
     inkscape:current-layer="g12" /><g
     id="g10"
     inkscape:groupmode="layer"
     inkscape:label="ink_ext_XXXXXX"
     transform="matrix(1.3333333,0,0,-1.3333333,0,127.33334)"><g
       id="g12"
       transform="scale(0.1)"><path
         d="M 276.648,761.871 366.293,657.48 c 3.844,-4.964 -1.25,-8.636 -1.25,-8.636 -35.922,-19.375 -61.914,-48.653 -84.148,-82.18 -4.415,-6.652 -9.176,-1.82 -9.176,-1.82 l -113.59,85.062 c 0,0 -4.883,2.871 -0.609,8.547 33.261,44.168 63.476,75.317 111.789,104.723 0,0 3.66,3.449 7.339,-1.305"
         style="fill:Color500;fill-opacity:1;fill-rule:nonzero;stroke:none"
         id="path14"
         inkscape:connector-curvature="0" /><path
         d="m 117.633,591.809 134.246,-64.895 c 6.379,-2.473 3.187,-8.281 3.187,-8.281 -18.546,-44.137 -29.847,-81.399 -38.566,-126.547 -1.461,-7.559 -6.59,-5.137 -6.59,-5.137 L 58.9063,452.516 c 0,0 -4.5274,1.695 -2.6368,7.511 6.7032,20.657 40.8594,103.118 54.5705,130.067 0,0 2.402,4.086 6.793,1.715"
         style="fill:Color600;fill-opacity:1;fill-rule:nonzero;stroke:none"
         id="path16"
         inkscape:connector-curvature="0" /><path
         d="m 42.5195,383.344 c 30.7071,-9.457 159.5545,-39.133 159.5545,-39.133 7.723,-2.379 5.422,-8.172 5.422,-8.172 -8.891,-70 -6.961,-123.422 -6.961,-141.879 0,-8.183 -5.957,-6.98 -5.957,-6.98 -33.449,0 -188.03112,0 -188.03112,0 -8.17188,0 -6.378911,7.363 -6.378911,7.363 1.535161,23.316 8.257811,89.668 34.183631,184.793 0,0 1.289,6.129 8.1679,4.008"
         style="fill:Color700;fill-opacity:1;fill-rule:nonzero;stroke:none"
         id="path18"
         inkscape:connector-curvature="0" /><path
         d="M 657.777,761.871 568.137,657.48 c -3.844,-4.964 1.25,-8.636 1.25,-8.636 35.922,-19.375 61.914,-48.653 84.148,-82.18 4.414,-6.652 9.176,-1.82 9.176,-1.82 l 113.59,85.062 c 0,0 4.883,2.871 0.609,8.547 -33.262,44.168 -63.476,75.317 -111.789,104.723 0,0 -3.66,3.449 -7.344,-1.305"
         style="fill:Color500;fill-opacity:1;fill-rule:nonzero;stroke:none"
         id="path20"
         inkscape:connector-curvature="0" /><path
         d="m 467.219,672.52 c 15.086,0 43.023,-1.442 56.211,-3.629 6.886,-1.141 8.59,3.41 8.59,3.41 l 56.425,117.914 c 0,0 3.778,4.437 -4.125,7.328 -42.117,15.41 -64.519,22.5 -117.101,22.5 -51.961,0 -74.992,-7.09 -117.114,-22.5 -7.898,-2.891 -4.125,-7.328 -4.125,-7.328 l 56.426,-117.914 c 0,0 1.703,-4.551 8.594,-3.41 13.184,2.187 41.125,3.629 56.219,3.629"
         style="fill:Color400;fill-opacity:1;fill-rule:nonzero;stroke:none"
         id="path22"
         inkscape:connector-curvature="0" /><path
         d="M 816.797,591.809 682.551,526.914 c -6.379,-2.473 -3.192,-8.281 -3.192,-8.281 18.551,-44.137 29.852,-81.399 38.571,-126.547 1.461,-7.559 6.586,-5.137 6.586,-5.137 l 151.007,65.567 c 0,0 4.528,1.695 2.637,7.511 -6.707,20.657 -40.859,103.118 -54.57,130.067 0,0 -2.402,4.086 -6.793,1.715"
         style="fill:Color600;fill-opacity:1;fill-rule:nonzero;stroke:none"
         id="path24"
         inkscape:connector-curvature="0" /><path
         d="m 891.91,383.344 c -30.711,-9.457 -159.555,-39.133 -159.555,-39.133 -7.722,-2.379 -5.421,-8.172 -5.421,-8.172 8.89,-70 6.957,-123.422 6.957,-141.879 0,-8.183 5.957,-6.98 5.957,-6.98 33.453,0 188.035,0 188.035,0 8.172,0 6.379,7.363 6.379,7.363 -1.535,23.316 -8.262,89.668 -34.184,184.793 0,0 -1.289,6.129 -8.168,4.008"
         style="fill:Color700;fill-opacity:1;fill-rule:nonzero;stroke:none"
         id="path26"
         inkscape:connector-curvature="0" /></g></g></svg>
"""

colors={'pink': {'200': '#f48fb1', '900': '#880e4f', '600': '#d81b60', 'A100': '#ff80ab', '300': '#f06292', 'A400': '#f50057', '700': '#c2185b', '50': '#fce4ec', 'A700': '#c51162', '400': '#ec407a', '100': '#f8bbd0', '800': '#ad1457', 'A200': '#ff4081', '500': '#e91e63'}, 'blue': {'200': '#90caf9', '900': '#0d47a1', '600': '#1e88e5', 'A100': '#82b1ff', '300': '#64b5f6', 'A400': '#2979ff', '700': '#1976d2', '50': '#e3f2fd', 'A700': '#2962ff', '400': '#42a5f5', '100': '#bbdefb', '800': '#1565c0', 'A200': '#448aff', '500': '#2196f3'}, 'indigo': {'200': '#9fa8da', '900': '#1a237e', '600': '#3949ab', 'A100': '#8c9eff', '300': '#7986cb', 'A400': '#3d5afe', '700': '#303f9f', '50': '#e8eaf6', 'A700': '#304ffe', '400': '#5c6bc0', '100': '#c5cae9', '800': '#283593', 'A200': '#536dfe', '500': '#3f51b5'}, 'blueGrey': {'200': '#b0bec5', '900': '#263238', '600': '#546e7a', '300': '#90a4ae', '700': '#455a64', '50': '#eceff1', '400': '#78909c', '100': '#cfd8dc', '800': '#37474f', '500': '#607d8b'}, 'brown': {'200': '#bcaaa4', '900': '#3e2723', '600': '#6d4c41', '300': '#a1887f', '700': '#5d4037', '50': '#efebe9', '400': '#8d6e63', '100': '#d7ccc8', '800': '#4e342e', '500': '#795548'}, 'lightBlue': {'200': '#81d4fa', '900': '#01579b', '600': '#039be5', 'A100': '#80d8ff', '300': '#4fc3f7', 'A400': '#00b0ff', '700': '#0288d1', '50': '#e1f5fe', 'A700': '#0091ea', '400': '#29b6f6', '100': '#b3e5fc', '800': '#0277bd', 'A200': '#40c4ff', '500': '#03a9f4'}, 'purple': {'200': '#ce93d8', '900': '#4a148c', '600': '#8e24aa', 'A100': '#ea80fc', '300': '#ba68c8', 'A400': '#d500f9', '700': '#7b1fa2', '50': '#f3e5f5', 'A700': '#aa00ff', '400': '#ab47bc', '100': '#e1bee7', '800': '#6a1b9a', 'A200': '#e040fb', '500': '#9c27b0'}, 'deepOrange': {'200': '#ffab91', '900': '#bf360c', '600': '#f4511e', 'A100': '#ff9e80', '300': '#ff8a65', 'A400': '#ff3d00', '700': '#e64a19', '50': '#fbe9e7', 'A700': '#dd2c00', '400': '#ff7043', '100': '#ffccbc', '800': '#d84315', 'A200': '#ff6e40', '500': '#ff5722'}, 'yellow': {'200': '#fff59d', '900': '#f57f17', '600': '#fdd835', 'A100': '#ffff8d', '300': '#fff176', 'A400': '#ffea00', '700': '#fbc02d', '50': '#fffde7', 'A700': '#ffd600', '400': '#ffee58', '100': '#fff9c4', '800': '#f9a825', 'A200': '#ffff00', '500': '#ffeb3b'}, 'lightGreen': {'200': '#c5e1a5', '900': '#33691e', '600': '#7cb342', 'A100': '#ccff90', '300': '#aed581', 'A400': '#76ff03', '700': '#689f38', '50': '#f1f8e9', 'A700': '#64dd17', '400': '#9ccc65', '100': '#dcedc8', '800': '#558b2f', 'A200': '#b2ff59', '500': '#8bc34a'}, 'grey': {'200': '#eeeeee', '900': '#212121', '600': '#757575', '300': '#e0e0e0', '700': '#616161', '50': '#fafafa', '400': '#bdbdbd', '100': '#f5f5f5', '800': '#424242', '500': '#9e9e9e'}, 'amber': {'200': '#ffe082', '900': '#ff6f00', '600': '#ffb300', 'A100': '#ffe57f', '300': '#ffd54f', 'A400': '#ffc400', '700': '#ffa000', '50': '#fff8e1', 'A700': '#ffab00', '400': '#ffca28', '100': '#ffecb3', '800': '#ff8f00', 'A200': '#ffd740', '500': '#ffc107'}, 'green': {'200': '#a5d6a7', '900': '#1b5e20', '600': '#43a047', 'A100': '#b9f6ca', '300': '#81c784', 'A400': '#00e676', '700': '#388e3c', '50': '#e8f5e9', 'A700': '#00c853', '400': '#66bb6a', '100': '#c8e6c9', '800': '#2e7d32', 'A200': '#69f0ae', '500': '#4caf50'}, 'red': {'200': '#ef9a9a', '900': '#b71c1c', '600': '#e53935', 'A100': '#ff8a80', '300': '#e57373', 'A400': '#ff1744', '700': '#d32f2f', '50': '#ffebee', 'A700': '#d50000', '400': '#ef5350', '100': '#ffcdd2', '800': '#c62828', 'A200': '#ff5252', '500': '#f44336'}, 'teal': {'200': '#80cbc4', '900': '#004d40', '600': '#00897b', 'A100': '#a7ffeb', '300': '#4db6ac', 'A400': '#1de9b6', '700': '#00796b', '50': '#e0f2f1', 'A700': '#00bfa5', '400': '#26a69a', '100': '#b2dfdb', '800': '#00695c', 'A200': '#64ffda', '500': '#009688'}, 'orange': {'200': '#ffcc80', '900': '#e65100', '600': '#fb8c00', 'A100': '#ffd180', '300': '#ffb74d', 'A400': '#ff9100', '700': '#f57c00', '50': '#fff3e0', 'A700': '#ff6d00', '400': '#ffa726', '100': '#ffe0b2', '800': '#ef6c00', 'A200': '#ffab40', '500': '#ff9800'}, 'cyan': {'200': '#80deea', '900': '#006064', '600': '#00acc1', 'A100': '#84ffff', '300': '#4dd0e1', 'A400': '#00e5ff', '700': '#0097a7', '50': '#e0f7fa', 'A700': '#00b8d4', '400': '#26c6da', '100': '#b2ebf2', '800': '#00838f', 'A200': '#18ffff', '500': '#00bcd4'}, 'deepPurple': {'200': '#b39ddb', '900': '#311b92', '600': '#5e35b1', 'A100': '#b388ff', '300': '#9575cd', 'A400': '#651fff', '700': '#512da8', '50': '#ede7f6', 'A700': '#6200ea', '400': '#7e57c2', '100': '#d1c4e9', '800': '#4527a0', 'A200': '#7c4dff', '500': '#673ab7'}, 'lime': {'200': '#e6ee9c', '900': '#827717', '600': '#c0ca33', 'A100': '#f4ff81', '300': '#dce775', 'A400': '#c6ff00', '700': '#afb42b', '50': '#f9fbe7', 'A700': '#aeea00', '400': '#d4e157', '100': '#f0f4c3', '800': '#9e9d24', 'A200': '#eeff41', '500': '#cddc39'}}

for primary in colors:
    txt = SVG
    txt=txt.replace('Color400', colors[primary]['400'])
    txt=txt.replace('Color500', colors[primary]['500'])
    txt=txt.replace('Color600', colors[primary]['600'])
    txt=txt.replace('Color700', colors[primary]['700'])
    fileout = file('icon-'+primary+'.svg', 'w')
    fileout.write(txt)
    fileout.close()
                