WxPython 颜色列表

#!/usr/bin/env python


import sys
import wx


app = wx.App()

if len(sys.argv) >= 2:
    fd = file(sys.argv[1], 'w')
else:
    fd = sys.stdout

print >> fd, '<HTML><TITLE>Color Database wxPython %s</TITLE><BODY>' % (wx.version(), )
print >> fd, '<TABLE BORDER=1><TR><TD>Color Code</TD><TD>Color Name</TD><TD>Color</TD></TR>'
colorDatabase = wx.ColourDatabase()
for i in xrange(0x1000000):
    name = colorDatabase.FindName('#%06X' % i)
    if len(name):
        print >> fd, '<TR><TD>#%06X</TD><TD>%s</TD><TD bgcolor="#%06X"></TD></TR>' % (i, name, i)

print >> fd, '</TABLE></BODY></HTML>'

fd.close()

 

运行结果:

Color Code Color Name Color
#000000 BLACK  
#0000FF BLUE  
#007FFF SLATE BLUE  
#00FF00 GREEN  
#00FF7F SPRING GREEN  
#00FFFF CYAN  
#23238E NAVY  
#236B8E STEEL BLUE  
#238E23 FOREST GREEN  
#238E6B SEA GREEN  
#2F2F2F DARK GREY  
#2F2F4F MIDNIGHT BLUE  
#2F4F2F DARK GREEN  
#2F4F4F DARK SLATE GREY  
#3232CC MEDIUM BLUE  
#3299CC SKY BLUE  
#32CC32 LIME GREEN  
#32CC99 MEDIUM AQUAMARINE  
#42426F CORNFLOWER BLUE  
#426F42 MEDIUM SEA GREEN  
#4F2F2F INDIAN RED  
#4F2F4F VIOLET  
#4F4F2F DARK OLIVE GREEN  
#545454 DIM GREY  
#5F9F9F CADET BLUE  
#646464 MEDIUM GREY  
#6B238E DARK SLATE BLUE  
#6B8E23 MEDIUM FOREST GREEN  
#6F4242 SALMON  
#7093DB DARK TURQUOISE  
#70DB93 AQUAMARINE  
#70DBDB MEDIUM TURQUOISE  
#7F00FF MEDIUM SLATE BLUE  
#7FFF00 MEDIUM SPRING GREEN  
#808080 GREY  
#8E2323 FIREBRICK  
#8E236B MAROON  
#8E6B23 SIENNA  
#8F8FBC LIGHT STEEL BLUE  
#8FBC8F PALE GREEN  
#9370DB MEDIUM ORCHID  
#93DB70 GREEN YELLOW  
#9932CC DARK ORCHID  
#99CC32 YELLOW GREEN  
#9F5F9F BLUE VIOLET  
#9F9F5F KHAKI  
#A52A2A BROWN  
#ADEAEA TURQUOISE  
#B000FF PURPLE  
#BFD8D8 LIGHT BLUE  
#C0C0C0 LIGHT GREY  
#CC3232 ORANGE  
#CC3299 VIOLET RED  
#CC7F32 GOLD  
#D8BFD8 THISTLE  
#D8D8BF WHEAT  
#DB7093 MEDIUM VIOLET RED  
#DB70DB ORCHID  
#DB9370 TAN  
#DBDB70 GOLDENROD  
#EAADEA PLUM  
#EAEAAD MEDIUM GOLDENROD  
#FF0000 RED  
#FF007F ORANGE RED  
#FF00FF LIGHT MAGENTA  
#FF7F00 CORAL  
#FFC0CB PINK  
#FFFF00 YELLOW  
#FFFFFF WHITE  

 

 

转自:http://blog.csdn.net/rehung/article/details/2567346

posted @ 2013-01-29 11:24  小妖.OTZ  阅读(1679)  评论(0编辑  收藏  举报