From 4d1a0dd3433795de10cb46d90b591d8ca6f8243a Mon Sep 17 00:00:00 2001 From: fourtf Date: Fri, 30 Dec 2016 19:20:04 +0100 Subject: [PATCH] hemirt BabyRage --- chatterino.pro | 6 ++++-- colorscheme.cpp | 14 +++++++++++++- colorscheme.h | 51 ++++++++++++++++++++++++++++++++++++++++++++++--- main.cpp | 6 +++++- 4 files changed, 70 insertions(+), 7 deletions(-) diff --git a/chatterino.pro b/chatterino.pro index 6bd55e9c..dd764331 100644 --- a/chatterino.pro +++ b/chatterino.pro @@ -29,13 +29,15 @@ SOURCES += main.cpp\ notebook.cpp \ notebooktab.cpp \ notebookpage.cpp \ - notebookbutton.cpp + notebookbutton.cpp \ + colorscheme.cpp HEADERS += mainwindow.h \ chatwidget.h \ notebook.h \ notebooktab.h \ notebookpage.h \ - notebookbutton.h + notebookbutton.h \ + colorscheme.h FORMS += diff --git a/colorscheme.cpp b/colorscheme.cpp index 25aacb4b..bf09fec1 100644 --- a/colorscheme.cpp +++ b/colorscheme.cpp @@ -1,6 +1,18 @@ +#include "QColor" #include "colorscheme.h" -ColorScheme::ColorScheme() +// hue: theme color (0 - 1) +// multiplyer: 1 = white, 0.8 = light, -0.8 dark, -1 black +void ColorScheme::makeScheme(float hue, float multiplyer) { + IsLightTheme = multiplyer > 0; + auto getColor = [IsLightTheme, multiplyer] (qreal h, qreal s, qreal l) -> QColor + { + return QColor::fromHslF(h, s, (((l - 0.5) * multiplyer) + 0.5)); + }; + + TextCaret = IsLightTheme ? QColor(0, 0, 0) : QColor(255, 255, 255); + + //ChatBorder = IsLightTheme ? QColor() } diff --git a/colorscheme.h b/colorscheme.h index bc0b7ede..eeb42dba 100644 --- a/colorscheme.h +++ b/colorscheme.h @@ -1,11 +1,56 @@ #ifndef COLORSCHEME_H #define COLORSCHEME_H +#include class ColorScheme { -public: - ColorScheme(); + static bool IsLightTheme; + + static QColor TooltipBackground; + static QColor TooltipText; + + static QColor ChatSeperator; + static QColor ChatBackground; + static QColor ChatBackgroundHighlighted; + static QColor ChatBackgroundResub; + static QColor ChatBackgroundWhisper; + static QColor ChatInputOuter; + static QColor ChatInputInner; + static QColor ChatInputBorder; + static QColor ChatMessageSeperatorBorder; + static QColor ChatMessageSeperatorBorderInner; + static QColor ChatBorder; + static QColor ChatBorderFocused; + + static QColor Text; + static QColor TextCaret; + static QColor TextLink; + static QColor TextFocused; + + static QColor Menu; + static QColor MenuBorder; + + static QColor ScrollbarBG; + static QColor ScrollbarThumb; + static QColor ScrollbarThumbSelected; + static QColor ScrollbarArrow; + + static QColor TabPanelBG; + static QColor TabBG; + static QColor TabHoverBG; + static QColor TabSelectedBG; + static QColor TabHighlightedBG; + static QColor TabNewMessageBG; + static QColor TabText; + static QColor TabHoverText; + static QColor TabSelectedText; + static QColor TabHighlightedText; + + static void makeScheme(float hue, float multiplyer); + +private: + Colorscheme() {} }; -#endif // COLORSCHEME_H \ No newline at end of file +#endif // COLORSCHEME_H diff --git a/main.cpp b/main.cpp index b48f94ec..cfd323bb 100644 --- a/main.cpp +++ b/main.cpp @@ -1,9 +1,13 @@ -#include "mainwindow.h" #include +#include "mainwindow.h" +#include "colorscheme.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); + + //ColorScheme::makeScheme(0, -0.8); + MainWindow w; w.show();