PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

38 行
1.2KB

  1. from pprint import pprint
  2. colors = []
  3. for r in range(0, 8):
  4. for g in range(0, 8):
  5. for b in range(0, 4):
  6. colors.append([
  7. int(round(r * 36.428571429)),
  8. int(round(g * 36.428571429)),
  9. b * 85
  10. ])
  11. pprint(colors)
  12. print(len(colors))
  13. # Create a simple html overview of the palette
  14. with open('palette.html', 'w') as f:
  15. f.write('<html><body>')
  16. for i, c in enumerate(colors):
  17. if i and not (i % 32):
  18. f.write('<br/>\n')
  19. f.write('<span style="background-color:rgb({r},{g},{b});width:30px;height:20px;margin:0;display:inline-block;">{i}</span>\n'.format(
  20. r=c[0], g=c[1], b=c[2], i=i)
  21. )
  22. f.write('<br/><br/>\n')
  23. for i, c in enumerate(colors):
  24. f.write('<div style="background-color:rgb({r}, {g}, {b})">{i}: {r}, {g}, {b}</div>\n'.format(r=c[0], g=c[1], b=c[2], i=i))
  25. f.write('</body></html>')
  26. with open('../standard_palette.h', 'w') as f:
  27. f.write('#include "color.h"\n\n')
  28. f.write('static const Palette standard_palette = {\n');
  29. f.write(",\n".join(['\t{{{r}, {r}, {b}}}'.format(r=c[0], g=c[1], b=c[2]) for c in colors]))
  30. f.write("\n};")