| 1674 | } |
| 1675 | |
| 1676 | ax::Color3B RichText::color3BWithString(std::string_view color) |
| 1677 | { |
| 1678 | if (color.length() == 4) |
| 1679 | { |
| 1680 | unsigned int r, g, b; |
| 1681 | sscanf(color.data(), "%*c%1x%1x%1x", &r, &g, &b); |
| 1682 | r += r * 16; |
| 1683 | g += g * 16; |
| 1684 | b += b * 16; |
| 1685 | return Color3B(r, g, b); |
| 1686 | } |
| 1687 | else if (color.length() == 7) |
| 1688 | { |
| 1689 | unsigned int r, g, b; |
| 1690 | sscanf(color.data(), "%*c%2x%2x%2x", &r, &g, &b); |
| 1691 | return Color3B(r, g, b); |
| 1692 | } |
| 1693 | else if (color.length() == 9) |
| 1694 | { |
| 1695 | unsigned int r, g, b, a; |
| 1696 | sscanf(color.data(), "%*c%2x%2x%2x%2x", &r, &g, &b, &a); |
| 1697 | return Color3B(r, g, b); |
| 1698 | } |
| 1699 | return Color3B::WHITE; |
| 1700 | } |
| 1701 | |
| 1702 | std::string RichText::stringWithColor3B(const ax::Color3B& color3b) |
| 1703 | { |
no test coverage detected