File indexing completed on 2024-05-12 13:47:34
0001 /* 0002 Copyright (C) 2013-2014 Volker Krause <vkrause@kde.org> 0003 0004 This program is free software; you can redistribute it and/or modify it 0005 under the terms of the GNU Library General Public License as published by 0006 the Free Software Foundation; either version 2 of the License, or (at your 0007 option) any later version. 0008 0009 This program is distributed in the hope that it will be useful, but WITHOUT 0010 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0011 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 0012 License for more details. 0013 0014 You should have received a copy of the GNU General Public License 0015 along with this program. If not, see <https://www.gnu.org/licenses/>. 0016 */ 0017 0018 #ifndef COLORIZER_H 0019 #define COLORIZER_H 0020 0021 #include <cstdint> 0022 0023 class QColor; 0024 0025 /** Provide visually pleasing and distinct colors for visualization purposes. 0026 * Or try at least... 0027 */ 0028 class Colorizer 0029 { 0030 public: 0031 explicit Colorizer(uint8_t saturation = 255, uint8_t value = 192); 0032 QColor nextColor(); 0033 0034 private: 0035 uint16_t m_hue = 0; 0036 uint8_t m_increment = 180; 0037 uint8_t m_offset = 90; 0038 uint16_t m_count = 0; 0039 uint8_t m_saturation; 0040 uint8_t m_value; 0041 }; 0042 0043 #endif // COLORIZER_H