MCPcopy Create free account
hub / github.com/VCVRack/Rack / fromHexString

Function fromHexString

src/color.cpp:74–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74NVGcolor fromHexString(std::string s) {
75 uint8_t r = 0;
76 uint8_t g = 0;
77 uint8_t b = 0;
78 uint8_t a = 255;
79 // If only three hex pairs are given, this will leave `a` unset.
80 sscanf(s.c_str(), "#%2hhx%2hhx%2hhx%2hhx", &r, &g, &b, &a);
81 return nvgRGBA(r, g, b, a);
82}
83
84std::string toHexString(NVGcolor c) {
85 uint8_t r = std::round(c.r * 255);

Callers 4

resetCablesFunction · 0.85
json_array_foreachFunction · 0.85
fromJsonMethod · 0.85
colorFromHexStringFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected