File indexing completed on 2024-04-28 05:50:49
0001 /* 0002 SPDX-FileCopyrightText: 2020-2020 Gustavo Carneiro <gcarneiroa@hotmail.com> 0003 SPDX-FileCopyrightText: 2007-2008 Robert Knight <robertknight@gmail.com> 0004 SPDX-FileCopyrightText: 1997, 1998 Lars Doelle <lars.doelle@on-line.de> 0005 0006 SPDX-License-Identifier: GPL-2.0-or-later 0007 */ 0008 0009 #ifndef TERMINALCOLOR_HPP 0010 #define TERMINALCOLOR_HPP 0011 0012 // Qt 0013 #include <QColor> 0014 #include <QWidget> 0015 0016 // Konsole 0017 #include "characters/CharacterColor.h" 0018 #include "konsoleprivate_export.h" 0019 #include "profile/Profile.h" 0020 0021 namespace Konsole 0022 { 0023 class Profile; 0024 class ColorScheme; 0025 0026 class KONSOLEPRIVATE_EXPORT TerminalColor : public QObject 0027 { 0028 Q_OBJECT 0029 public: 0030 explicit TerminalColor(QObject *parent); 0031 0032 void applyProfile(const Profile::Ptr &profile, const std::shared_ptr<const ColorScheme> &colorScheme, uint randomSeed); 0033 0034 QColor backgroundColor() const; 0035 QColor foregroundColor() const; 0036 void setColorTable(const QColor *table); 0037 const QColor *colorTable() const; 0038 0039 void onColorsChanged(); 0040 0041 void setOpacity(qreal opacity); 0042 0043 void visualBell(); 0044 0045 qreal opacity() const; 0046 QRgb blendColor() const; 0047 0048 QColor cursorColor() const 0049 { 0050 return m_cursorColor; 0051 } 0052 0053 void setCursorColor(const QColor &color); 0054 0055 QColor cursorTextColor() const 0056 { 0057 return m_cursorTextColor; 0058 } 0059 0060 public Q_SLOTS: 0061 void setBackgroundColor(const QColor &color); 0062 void setForegroundColor(const QColor &color); 0063 0064 Q_SIGNALS: 0065 void onPalette(const QPalette &); 0066 0067 private Q_SLOTS: 0068 void swapFGBGColors(); 0069 0070 private: 0071 qreal m_opacity = 1; 0072 QRgb m_blendColor = qRgba(0, 0, 0, 0xff); 0073 0074 QColor m_cursorColor; 0075 QColor m_cursorTextColor; 0076 0077 QColor m_colorTable[TABLE_COLORS]; 0078 }; 0079 } 0080 0081 #endif