| 82 | } |
| 83 | |
| 84 | std::string toHexString(NVGcolor c) { |
| 85 | uint8_t r = std::round(c.r * 255); |
| 86 | uint8_t g = std::round(c.g * 255); |
| 87 | uint8_t b = std::round(c.b * 255); |
| 88 | uint8_t a = std::round(c.a * 255); |
| 89 | if (a == 255) |
| 90 | return string::f("#%02x%02x%02x", r, g, b); |
| 91 | else |
| 92 | return string::f("#%02x%02x%02x%02x", r, g, b, a); |
| 93 | } |
| 94 | |
| 95 | |
| 96 | } // namespace network |
no test coverage detected