Created
April 22, 2010 12:27
-
-
Save matagus/375156 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Build an .xls file with all background colors vs patterns possibilities""" | |
import xlwt | |
wb = xlwt.Workbook() | |
ws = wb.add_sheet("Colors") | |
ws.write(0, 0, "Colors/Patterns") | |
for pat_index in range(0, 16): | |
ws.write(0, pat_index + 1, str(pat_index)) | |
for i in range(0, 250): | |
hex_color = hex(i) | |
# print color hex code | |
ws.write(i +1, 0, unicode(hex_color)) | |
# pattern index may vary between 0 and 16 | |
for pat_index in range(0, 16): | |
pattern = xlwt.Pattern() | |
pattern.pattern = pat_index | |
pattern.pattern_fore_colour = i | |
some_style = xlwt.XFStyle() | |
some_style.pattern = pattern | |
ws.write(i + 1, 1 + pat_index, "", some_style) | |
wb.save("excel_color.xls") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment