Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
C

color

> 数据库
Open source

C++ library thats implemets class color. Available models: RGB, HSL, HSV, CMY, CMYK, YIQ, YUV and growing.

186 stars0 likes4 views
WebsiteGitHub

About

C++ library thats implemets class color. Available models: RGB, HSL, HSV, CMY, CMYK, YIQ, YUV and growing.

Yet another c++ library that implements color.

Description

  • Yet another c++ library that implements color conversion and manipulation.

Key features:

  • No virtual functions
  • Minimal memory footprint
  • Ability to copy array/vector of colors with memcpy, memmove and initialize with memset.
  • Conversions from/to different models ( and its formats ).
  • Headers only
    • One file to include to start the fun
    • By using del or rm it is reducible in to only two of them.
  • No third parties
  • No additional binaries
  • Out of the box ready
    • No need to recompile or start some install process.
  • Color models:
    • GRAY,
    • RGB, CMY, CMYK,
    • HSI, HSL, HSV, HWB, TSL
    • YIQ, YUV(BT.601, BT.709), YCgCo, YPbPr(BT.601, BT.709, BT.2020),
    • XYZ( sRGB, D65, 2° ), LAB( CIE, Hunter), LUV, LMS( von Kries D65, von Kries E, BFD, MCAT02 ), xyY, LabCH, LuvCH

Code sample - Initialization:

cpp
// Initialize with constant.
color::bgr  b( ::color::constant::aqua_t{} );

//!  y( ::color::constant::x11::green_t{} );

// Use intuitive/natural values for initialization.
// hue goes from 0 to 360, saturation and value from 0 to 100.
color::hsv        h( { 120.0, 50.0, 60.0 } );

// Lightens will goes from 0 to 100. a and b from -127 to 127.
color::lab         l( { 50.0, -10, 90 } );

// Well known rgb. Values are between 0 and 1.
color::rgb         r( { 0.5, 0, 0.9 } );

Code sample - Conversion:

cpp
// any model/format to any model/format by use of operator=

b = r; //! to hsv
h = y; //! to hsv
l = y; //! to lab

Code sample - Feature Extraction:

cpp
color::rgb  r = ::color::constant::aqua_t{};
::color::get::red( r ); //!  y = ::color::constant::orange_t{};
::color::get::red( y ); //!  r0 = aqua_t{};
rgb  r1 = turquoise_t{};
yiq  y  = orange_t{};

cout ( r0, r1 ) ( r0, y ) ( r0, y ) ( r0, y ) ( r0, y ) ( r0, y, 1, 2 ) ( r0, r1 )   y1 = ::color::constant::turquoise_t{};
color::yiq  y2 = ::color::constant::orange_t{};
color::yiq  yr;

::color::operation::blend(  y1, 0.1, y2 ); //!< Blend two colors for given alpha. Accumulation style.
yr = color::operation::mix( y2, 0.5, y2 ); //!< Blend two colors for given alpha. return style.

Install:

  1. Clone this Repository:
    Examples:
    • Windows : git clone https://github.com/dmilos/color.git c:\my-work-folder\my-git-folder\color
    • Linux : git clone https://github.com/dmilos/color.git /home/my-user-name/my-work-folder/my-git-folder/color
  2. Inform compiler where to find headers:
    Examples:
    • MSVC : /Ic:\my-work-folder\my-git-folder\color\src
    • gcc : -I/home/my-user-name/my-work-folder/my-git-folder/color/src

Want to see more:

  • HTML Documentation
  • Wiki page

Tested against:

  • GCC 13.4.0, C++11,14,17,20
  • MSVC 2022 17.14.9 C++11,14,17,20
  • MSVC 2022 17.14.9 CLang, C++11,14,17,20

(Links

  • ibireme
  • YUV, YCbCr, YPbPr color spaces
  • Bruce Justin Lindbloom
  • colorizer
  • Parameter values for ultra-high definition television systems for production and international programme exchange

License

Licensed under an Apache-2.0 license.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C++c-plus-pluscolorcross-platformheader-only

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category数据库
PricingOpen source

> Related tools

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库