我目前正在做一个有颜色的项目,并想知道是否有一个列表或某种方式来生成十六进制的所有Adobe RGB颜色的列表?
谢谢!
答案 0 :(得分:0)
这是一个python脚本,如果像这样运行,它会将它们写入128兆字节的文件
python hexen.py > reallybiglist.txt
这是脚本
# write int as 6-digit hex
def int_6_hex(intval):
hex = ""
while intval != 0:
hexValue = intval % 16
hex = toHexChar(hexValue) + hex
intval = intval // 16
while len(hex) < 6:
hex = "0" + hex
return hex
# Convert an integer to a single hex digit in a character
def toHexChar(hexValue):
if 0 <= hexValue <= 9:
return chr(hexValue + ord('0'))
else: # 10 <= hexValue <= 15
return chr(hexValue - 10 + ord('A'))
#loop to ffffff
def main():
intmax = 256*256*256
# intmax = 256 -- to see a preview
loopint = 0
while (loopint < intmax):
print(int_6_hex(loopint))
loopint = loopint + 1
main() # Call the main function