cmCursesColor.cxx 769 B

1234567891011121314151617181920212223242526272829
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #include "cmCursesColor.h"
  4. #include "cmCursesStandardIncludes.h"
  5. bool cmCursesColor::HasColors()
  6. {
  7. #ifdef HAVE_CURSES_USE_DEFAULT_COLORS
  8. return has_colors();
  9. #else
  10. return false;
  11. #endif
  12. }
  13. void cmCursesColor::InitColors()
  14. {
  15. #ifdef HAVE_CURSES_USE_DEFAULT_COLORS
  16. if (HasColors()) {
  17. start_color();
  18. use_default_colors();
  19. init_pair(cmCursesColor::BoolOff, COLOR_RED, -1);
  20. init_pair(cmCursesColor::BoolOn, COLOR_GREEN, -1);
  21. init_pair(cmCursesColor::String, COLOR_BLUE, -1);
  22. init_pair(cmCursesColor::Path, COLOR_YELLOW, -1);
  23. init_pair(cmCursesColor::Options, COLOR_MAGENTA, -1);
  24. }
  25. #endif
  26. }