| 80 | }; |
| 81 | |
| 82 | QColor invertColor(const QColor& color) |
| 83 | { |
| 84 | auto hue = color.hsvHue(); |
| 85 | if (hue == -1) { |
| 86 | // achromatic color |
| 87 | hue = 0; |
| 88 | } |
| 89 | return QColor::fromHsv(hue, color.hsvSaturation(), 255 - color.value()); |
| 90 | } |
| 91 | |
| 92 | std::optional<QColor> foregroundColor(const QTextFormat& format) |
| 93 | { |