PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

generate_standard_palette.py 1.2KB

pirms 3 gadiem
12345678910111213141516171819202122232425262728293031323334353637
  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};")