color.hpp 629 B

12345678910111213141516171819202122232425
  1. #pragma once
  2. namespace lumacs {
  3. /// RGB Color representation
  4. struct Color {
  5. int r, g, b;
  6. Color(int r = 0, int g = 0, int b = 0) : r(r), g(g), b(b) {}
  7. /// Convert to ncurses color index (will be assigned dynamically)
  8. int to_ncurses_color() const;
  9. /// Comparison operator for use in maps
  10. bool operator<(const Color& other) const {
  11. if (r != other.r) return r < other.r;
  12. if (g != other.g) return g < other.g;
  13. return b < other.b;
  14. }
  15. bool operator==(const Color& other) const {
  16. return r == other.r && g == other.g && b == other.b;
  17. }
  18. };
  19. } // namespace lumacs