【问题标题】:List of entire Adobe RGB colour space as hexadecimal?整个 Adob​​e RGB 颜色空间列表为十六进制?
【发布时间】:2017-11-08 02:23:40
【问题描述】:

我目前正在做一个带有颜色的项目,想知道是否有一个列表或某种方法可以生成所有 Adob​​e RGB 颜色的十六进制列表?

谢谢!

【问题讨论】:

  • 这只是来自阅读 wiki 文章,该文章说值是 [0,0,0] ... [1,1,1] 作为小数,所以我可能错过了重点。你的意思是 000000 到 FFFFFF 的表吗?
  • @DaveS 是的,这样的东西真的很理想
  • 只有 16,777,216 行的数字列表?
  • @DaveS 听起来很荒谬......是的
  • 这是 PC 还是 Mac 或 ...? (我们可以使用哪些语言?)

标签: colors hex adobe rgb


【解决方案1】:

这是一个 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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-07-25
    • 1970-01-01
    • 1970-01-01
    • 2016-12-27
    • 2012-11-01
    • 2022-08-10
    • 2018-10-22
    • 2014-04-25
    相关资源
    最近更新 更多