color.h 756 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. //
  2. // color.h
  3. // ncurses-wrapper
  4. //
  5. // Created by Sam Jaffe on 7/23/24.
  6. //
  7. #include <compare>
  8. namespace curses {
  9. struct Color {
  10. // https://www.rapidtables.com/web/color/RGB_Color.html
  11. static Color const DEFAULT;
  12. static Color const BLACK;
  13. static Color const RED;
  14. static Color const GREEN;
  15. static Color const YELLOW;
  16. static Color const BLUE;
  17. static Color const MAGENTA;
  18. static Color const CYAN;
  19. static Color const WHITE;
  20. auto operator<=>(Color const &) const = default;
  21. static Color from_code(short code);
  22. short to_code() const;
  23. short red;
  24. short green;
  25. short blue;
  26. };
  27. struct ColorPair {
  28. auto operator<=>(ColorPair const &) const = default;
  29. int to_code() const;
  30. Color foreground;
  31. Color background;
  32. };
  33. }