| 51 | } |
| 52 | |
| 53 | QColor WidgetColorizer::colorForId(uint id, const QPalette& activePalette, bool forBackground) |
| 54 | { |
| 55 | const int high = 255; |
| 56 | const int low = 100; |
| 57 | auto color = QColor(qAbs(id % (high - low)), |
| 58 | qAbs((id / 50) % (high - low)), |
| 59 | qAbs((id / (50 * 50)) % (high - low))); |
| 60 | const auto& foreground = activePalette.windowText().color(); |
| 61 | const auto& background = activePalette.window().color(); |
| 62 | if (forBackground) { |
| 63 | return blendBackground(color, .5, foreground, background); |
| 64 | } else { |
| 65 | return blendForeground(color, .5, foreground, background); |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | bool WidgetColorizer::colorizeByProject() |
| 70 | { |