| 270 | } |
| 271 | |
| 272 | bool Color::fromName(std::string name, bool strict) |
| 273 | { |
| 274 | std::for_each(name.begin(), name.end(), [](char& c) { c = std::tolower(c); }); |
| 275 | if (const auto& color = ColorNames.find(name); color != ColorNames.end()) |
| 276 | { |
| 277 | this->r = color->second.r; |
| 278 | this->g = color->second.g; |
| 279 | this->b = color->second.b; |
| 280 | this->a = color->second.a; |
| 281 | return true; |
| 282 | } |
| 283 | if (!strict) |
| 284 | return false; |
| 285 | throw Exceptions::InvalidColorName(name, EXC_INFO); |
| 286 | } |
| 287 | |
| 288 | void Color::fromRgb(const double r, const double g, const double b, const double a) |
| 289 | { |
no test coverage detected