An almost dependency-less library for converting between color spaces
This package contains representations for two different color spaces with two different datatypes in include/color_util/types.hpp:
- Red-Green-Blue-Alpha (
RGBA) - Hue-Saturation-Value-Alpha (
HSVA).
Each of these are represented with two datatypes.
- Four
doubles with values ranging[0.0, 1.0] - Four
unsigned chars with values ranging[0, 255].
Note that with unsigned char, the color is represented by a total of 24 bits, which we use for notation. The four resulting types are
ColorRGBA-RGBA/doubleColorRGBA24-RGBA/unsigned charColorHSVA-HSVA/doubleColorHSVA24-HSVA/unsigned char
With include/color_util/convert.hpp, you can convert between the above types and to std_msgs::msg::ColorRGBA (which has floating point as its datatype).
With include/color_util/blend.hpp, you can create mixtures of two different colors. There are three options.
You can experiment with the blending methods by running roslaunch robot_nav_viz_demos spectrum_demo.launch.
For certain applications, there is a need for accessing specific colors, and it can be annoying to have to specify hex values for each individual color. Other times, you may want to access a list of some number of unique colors. For this, this package provides the named_colors header which allows you to access an array of 55 named colors either through a vector or an enum. The colors are made up of 18 colors, each with a standard, light and dark variant, plus transparent.
The list can be accessed with color_util::getNamedColors() and individual colors can be grabbed with color_util::get(NamedColor::RED)



