Colorful command line output C/C++ macros, very flexible!
Branch: develop
Clone or download
Latest commit 5935ab8 Feb 10, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
cmake Give more precedence to per-instance CMake option Feb 9, 2019
examples Rename 'local' example Nov 27, 2018
.travis.yml Read config option from env var Feb 9, 2019
CMakeLists.txt Reflect lazy contributor in authors list Nov 27, 2018
ColorDebug.h Rename color tags (v0.17) Feb 9, 2019
LICENSE Add LICENSE per CopyPolicy in ColorDebug.hpp Mar 12, 2017 Add NO_COLOR disclaimer Feb 9, 2019


Build Status (Linux/Windows) Issues

Color CLI logs and more. Lightweight and simple, mainly achieved via ANSI escape codes. For updated version, license and author information, see ColorDebug.h.


Requirements: CMake 2.8.12.

Possible usages:

  • Install system-wide: mkdir -p ~/repos && cd ~/repos && git clone && mkdir -p color-debug/build && cd color-debug/build && cmake .. && sudo make install. In CMake, you may load it with find_package(COLOR_DEBUG) and then target_link_libraries(myTarget ROBOTICSLAB::ColorDebug).

  • Use externally: Skipping final sudo make install step, perform commands described above. Set the COLOR_DEBUG_DIR environment variable to your build path (optional, color-debug will store this path in the user registry for use by every cmake run). In CMake, you may load it with find_package(COLOR_DEBUG) and then target_link_libraries(myTarget ROBOTICSLAB::ColorDebug).

  • As part of another project: copy this repository to the desired location inside your source tree, make it discoverable by CMake (traverse its tree with add_subdirectory(...)) and add target_link_libraries(myTarget ROBOTICSLAB::ColorDebug) as usual.

  • (discontinued, last working commit was 5b8c9fd) Pulled by YCM. This is the BuildCOLOR_DEBUG.cmake file we use at kinematics-dynamics:

    ycm_ep_helper(COLOR_DEBUG TYPE GIT
                  STYLE GITHUB
                  REPOSITORY roboticslab-uc3m/color-debug.git
                  TAG master)
    # Include path to ColorDebug.h.
    ExternalProject_Get_Property(COLOR_DEBUG INSTALL_DIR)
    # CMake has not downloaded color-debug yet (this happens on build step).
        message(STATUS "Build COLOR_DEBUG target and configure project again to make advanced CD options available on UI.")
        # Load COLOR_DEBUGConfig.cmake, which in turn includes ColorDebugOptions.cmake.
        find_package(COLOR_DEBUG QUIET)

    Additionally, for every library or executable target that needs ColorDebug.h, you must use add_dependencies(my_target COLOR_DEBUG). If you want to search for system-available color-debug first, add this to your root CMakeLists.txt after calling find_or_build_package(COLOR_DEBUG):

        find_package(COLOR_DEBUG REQUIRED)

You can enable or disable specific features of color-debug by manipulating the corresponding CMake options. See cmake/ColorDebugOptions.cmake for details.

This utility adheres to the informal NO_COLOR standard, that is, ANSI color escape codes will not be generated in your ColorDebug-dependent project if the NO_COLOR environmental variable is defined (regardless of its value).

Similar and Related Projects