That Terminal
A terminal emulator designed for video making purposes.
color.cc File Reference

Defines conversions between different color formats and parsing colors defined in strings. More...

#include <array>
#include <string>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <vector>
#include <algorithm>
#include "ctype.hh"
#include "color.hh"
Include dependency graph for color.cc:

Classes

struct  fixed_string< N >
 

Macros

#define docolors(o)
 
#define o(a, b, ...)   case a: return b; break;
 
#define v(a, b, ...)   VerifyHash<a, __VA_ARGS__>();
 
#define o(a, b, ...)   a,
 
#define q(a, b, ...)   b,
 

Enumerations

enum  { use_separator =1 , lsb_first =2 , use_dbl =4 }
 

Functions

unsigned ParseColorName (std::u32string_view s)
 
unsigned ParseColorName (std::string_view s)
 

Detailed Description

Defines conversions between different color formats and parsing colors defined in strings.

Function Documentation

◆ ParseColorName()

unsigned ParseColorName ( std::string_view  s)

ParseColorName() parses the given string and returns a corresponding RGB color as a 24-bit integer.

Recognized formats are: #RGB (each color channel is 4-bit hexadecimal number; range: 0-F) #RRGGBB (each color channel is 8-bit hexadecimal number; range: 00-FF) rgb:R/G/B (each color channel is 4-bit hexadecimal number; range: 0-F) rgbi:1/1/1 (each color channel is a decimal floating point value; range: 0-1) gold (color names recognized by X11 are recognized, case sensitive) Anything else produces undefined results.