2017-06-06 36 views
0

我目前正在用顏色做一個項目,並想知道是否有列表或某種方式來生成十六進制的所有Adobe RGB顏色列表?整個Adobe RGB顏色空間列表爲十六進制?

謝謝!

+0

這只是從閱讀wiki文章這說的是值爲[0,0,0] ... [1,1,1]爲小數,所以我可能錯過了這一點。你的意思是表達000000到FFFFFF嗎? –

+0

@DaveS是的,這樣的事情會很理想 – dnkmelon

+0

只是一個16,777,216行數列表? –

回答

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