git.haldean.org qb / b340f54 colors.cpp
b340f54

Tree @b340f54 (Download .tar.gz)

colors.cpp @b340f54raw · history · blame

#include "imgui.h"
#include "colors.hpp"

namespace qb {
  namespace theme {
    int32_t colors[color::ncolors] = {0};

    static const char * colorname(color c) {
      switch (c) {
      case background: return "background";
      case waveform: return "waveform";
      case playhead: return "playhead";
      }
      return "unknown";
    }

    void setdefault() {
      colors[color::background] = IM_COL32(99, 0, 29, 255);
      colors[color::waveform] = IM_COL32(255, 158, 0, 255);
      colors[color::playhead] = IM_COL32(154, 0, 42, 255);
    }

    void showeditor() {
      ImGui::Begin("theme editor");
      for (int c = 0; c < ncolors; c++) {
        ImVec4 ic = ImColor(colors[c]);
        ImGui::ColorEdit4(colorname((color)c), &ic.x);
        colors[c] = ImColor(ic);
      }
      ImGui::ShowStyleEditor();
      ImGui::End();
    }
  }
}