* @brief Returns the top gradient color for the given device source index. */
| 718 | * @brief Returns the top gradient color for the given device source index. |
| 719 | */ |
| 720 | QColor SerialStudio::getDeviceTopColor(const int sourceId) |
| 721 | { |
| 722 | if (sourceId <= 0) |
| 723 | return QColor(Qt::transparent); |
| 724 | |
| 725 | static const auto* theme = &Misc::ThemeManager::instance(); |
| 726 | const auto& colors = theme->deviceColors(); |
| 727 | |
| 728 | if (colors.isEmpty()) |
| 729 | return QColor(Qt::transparent); |
| 730 | |
| 731 | return colors.at((sourceId - 1) % colors.count()).first; |
| 732 | } |
| 733 | |
| 734 | /** |
| 735 | * @brief Returns the bottom gradient color for the given device source index. |