1 /* 2 SPDX-FileCopyrightText: 2020-2020 Gustavo Carneiro <gcarneiroa@hotmail.com> 3 SPDX-FileCopyrightText: 2007-2008 Robert Knight <robertknight@gmail.com> 4 SPDX-FileCopyrightText: 1997, 1998 Lars Doelle <lars.doelle@on-line.de> 5 6 SPDX-License-Identifier: GPL-2.0-or-later 7 */ 8 9 #ifndef TERMINALCOLOR_HPP 10 #define TERMINALCOLOR_HPP 11 12 // Qt 13 #include <QColor> 14 #include <QWidget> 15 16 // Konsole 17 #include "characters/CharacterColor.h" 18 #include "konsoleprivate_export.h" 19 #include "profile/Profile.h" 20 21 namespace Konsole 22 { 23 class Profile; 24 class ColorScheme; 25 26 class KONSOLEPRIVATE_EXPORT TerminalColor : public QObject 27 { 28 Q_OBJECT 29 public: 30 explicit TerminalColor(QObject *parent); 31 32 void applyProfile(const Profile::Ptr &profile, ColorScheme const *colorScheme, uint randomSeed); 33 34 QColor backgroundColor() const; 35 QColor foregroundColor() const; 36 void setColorTable(const QColor *table); 37 const QColor *colorTable() const; 38 39 void onColorsChanged(); 40 41 void setOpacity(qreal opacity); 42 43 void visualBell(); 44 45 qreal opacity() const; 46 QRgb blendColor() const; 47 cursorColor()48 QColor cursorColor() const 49 { 50 return m_cursorColor; 51 } 52 cursorTextColor()53 QColor cursorTextColor() const 54 { 55 return m_cursorTextColor; 56 } 57 58 public Q_SLOTS: 59 void setBackgroundColor(const QColor &color); 60 void setForegroundColor(const QColor &color); 61 62 Q_SIGNALS: 63 void onPalette(const QPalette &); 64 65 private Q_SLOTS: 66 void swapFGBGColors(); 67 68 private: 69 qreal m_opacity; 70 QRgb m_blendColor; 71 72 QColor m_cursorColor; 73 QColor m_cursorTextColor; 74 75 QColor m_colorTable[TABLE_COLORS]; 76 }; 77 } 78 79 #endif 80