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

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:
    for accent in colors:
        if primary != accent:
            filein = file('template_color.css')
            txt = filein.read()
            for val in colors[primary]:
                txt = txt.replace('Primary'+val, colors[primary][val])
            for val in colors[accent]:
                txt = txt.replace('Accent'+val, colors[accent][val])
            fileout = file('color-'+primary+'-'+accent+'.css', 'w')
            fileout.write(txt)
            fileout.close()
            filein.close()
                