aest 0.1.0
Collection of C++ utility libraries
Loading...
Searching...
No Matches
colors Directory Reference

Directories

 
src

Detailed Description

aest.colors

Color types and conversions, under the aest::colors namespace.

#include <string>
import aest.colors;
constexpr SRGB coral = aest::colors::from_hex(0xFF7F50);
std::string hex = aest::colors::hex_string(coral); // "#FF7F50"
HSL hsl = aest::colors::convert<HSL>(coral); // SRGB -> HSL
HSL green = aest::colors::from_rgba<HSL>(0, 120, 80); // SRGB bytes -> HSL
SRGB faded = aest::colors::css::teal.opacity(0.5f); // named CSS colors
constexpr ColorOut convert(const ColorIn &color)
Convert a color from one color space to another.
BasicHSL< SRGB > HSL
HSL over sRGB, the HSL of CSS.
BasicRGB< gamut::SRGB, tf::SRGB > SRGB
sRGB with gamma-encoded channels: the encoding of hex codes, 8-bit channels and CSS colors.
Definition Gamut.cppm:370
constexpr Color from_rgba(const std::uint8_t r, const std::uint8_t g, const std::uint8_t b, const std::uint8_t a=BYTE_MAX)
Build a color from 8-bit SRGB channels.
Definition Hex.cppm:37
constexpr Color from_hex(const std::uint32_t hex)
Build a color from an SRGB hex code, a 32-bit integer in 0xRRGGBB format, as in from_hex(0xFF7F50).
Definition Hex.cppm:81
std::string hex_string(const Color &color)
Convert a color to SRGB and write it as a hex code in #RRGGBB format, without alpha.
Definition Hex.cppm:141
constexpr SRGB teal
CSS teal, #008080.
constexpr Derived opacity(const float alpha) const
Returns a new color with the same channels and the specified alpha value.
Definition Color.cppm:209

Usage

With vcpkg (see the root README for registry setup):

{ "dependencies": ["aest-colors"] }
find_package(aest-colors CONFIG REQUIRED)
target_link_libraries(app PRIVATE aest::colors)

Layout

Path Content
src/ Primary interface lib.ixx and partitions (.cppm)
tests/ Catch2 unit tests
examples/ Usage examples (-DAEST_BUILD_EXAMPLES=ON)
docs/ Additional Doxygen pages