| 585 | } |
| 586 | |
| 587 | QColor CodeEditor::interpolate(QColor start,QColor end,double ratio) |
| 588 | { |
| 589 | //From https://stackoverflow.com/questions/3306786/get-intermediate-color-from-a-gradient |
| 590 | int r = static_cast<int>(ratio*start.red() + (1-ratio)*end.red()); |
| 591 | int g = static_cast<int>(ratio*start.green() + (1-ratio)*end.green()); |
| 592 | int b = static_cast<int>(ratio*start.blue() + (1-ratio)*end.blue()); |
| 593 | int a = static_cast<int>(ratio*start.alpha() + (1-ratio)*end.alpha()); |
| 594 | QColor c = QColor::fromRgb(r,g,b); |
| 595 | c.setAlpha(a); // Strangely there seems to be no clean way of creating a rgba color, fromRgba does not take 4 parameters as one would expect. |
| 596 | return c; |
| 597 | } |
| 598 | |
| 599 | QColor CodeEditor::heatColor(double ratio) |
| 600 | { |
nothing calls this directly
no outgoing calls
no test coverage detected