You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
1.6KB

  1. #include <ui.hpp>
  2. namespace rack {
  3. namespace ui {
  4. void init(){
  5. setTheme(nvgRGB(0x33, 0x33, 0x33), nvgRGB(0xf0, 0xf0, 0xf0));
  6. }
  7. void destroy() {
  8. }
  9. void setTheme(NVGcolor bg, NVGcolor fg) {
  10. // Assume dark background and light foreground
  11. BNDwidgetTheme w;
  12. w.outlineColor = bg;
  13. w.itemColor = fg;
  14. w.innerColor = bg;
  15. w.innerSelectedColor = color::plus(bg, nvgRGB(0x30, 0x30, 0x30));
  16. w.textColor = fg;
  17. w.textSelectedColor = fg;
  18. w.shadeTop = 0;
  19. w.shadeDown = 0;
  20. BNDtheme t;
  21. t.backgroundColor = color::plus(bg, nvgRGB(0x30, 0x30, 0x30));
  22. t.regularTheme = w;
  23. t.toolTheme = w;
  24. t.radioTheme = w;
  25. t.textFieldTheme = w;
  26. t.optionTheme = w;
  27. t.choiceTheme = w;
  28. t.numberFieldTheme = w;
  29. t.sliderTheme = w;
  30. t.scrollBarTheme = w;
  31. t.tooltipTheme = w;
  32. t.menuTheme = w;
  33. t.menuItemTheme = w;
  34. t.sliderTheme.itemColor = bg;
  35. t.sliderTheme.innerColor = color::plus(bg, nvgRGB(0x50, 0x50, 0x50));
  36. t.sliderTheme.innerSelectedColor = color::plus(bg, nvgRGB(0x60, 0x60, 0x60));
  37. t.textFieldTheme = t.sliderTheme;
  38. t.textFieldTheme.textColor = color::minus(bg, nvgRGB(0x20, 0x20, 0x20));
  39. t.textFieldTheme.textSelectedColor = t.textFieldTheme.textColor;
  40. t.textFieldTheme.itemColor = color::plus(bg, nvgRGB(0x30, 0x30, 0x30));
  41. t.scrollBarTheme.itemColor = color::plus(bg, nvgRGB(0x50, 0x50, 0x50));
  42. t.scrollBarTheme.innerColor = bg;
  43. t.menuTheme.innerColor = color::minus(bg, nvgRGB(0x10, 0x10, 0x10));
  44. t.menuTheme.textColor = color::minus(fg, nvgRGB(0x50, 0x50, 0x50));
  45. t.menuTheme.textSelectedColor = t.menuTheme.textColor;
  46. bndSetTheme(t);
  47. }
  48. } // namespace ui
  49. } // namespace rack