Added code for ubuntu color style

This commit is contained in:
fourtf 2017-08-17 14:52:41 +02:00
parent a4533ae92c
commit ca65e543ec
6 changed files with 43 additions and 31 deletions

3
.gitignore vendored
View file

@ -64,3 +64,6 @@ Session.vim
*~ *~
# Vim Auto-generated tag files # Vim Auto-generated tag files
tags tags
# rapidjson directory
rapidjson/*

View file

@ -62,7 +62,7 @@ void ColorScheme::setColors(double hue, double multiplier)
SystemMessageColor = QColor(140, 127, 127); SystemMessageColor = QColor(140, 127, 127);
auto getColor = [multiplier](double h, double s, double l, double a = 1.0) { auto getColor = [multiplier](double h, double s, double l, double a = 1.0) {
return QColor::fromHslF(h, s, (((l - 0.5) * multiplier) + 0.5), a); return QColor::fromHslF(h, s, ((l - 0.5) * multiplier) + 0.5, a);
}; };
DropPreviewBackground = getColor(hue, 0.5, 0.5, 0.6); DropPreviewBackground = getColor(hue, 0.5, 0.5, 0.6);
@ -71,26 +71,29 @@ void ColorScheme::setColors(double hue, double multiplier)
TextLink = lightTheme ? QColor(66, 134, 244) : QColor(66, 134, 244); TextLink = lightTheme ? QColor(66, 134, 244) : QColor(66, 134, 244);
// tab // tab
if (hasDarkBorder) { if (true) {
// TabPanelBackground = getColor(hue, 0, 0.8);
// TabBackground = getColor(hue, 0, 0.8);
// TabHoverBackground = getColor(hue, 0, 0.8);
} else {
TabPanelBackground = QColor(255, 255, 255);
TabBackground = QColor(255, 255, 255);
TabHoverBackground = getColor(hue, 0, 0.05);
}
TabSelectedBackground = getColor(hue, 0.5, 0.5);
TabHighlightedBackground = getColor(hue, 0.5, 0.2);
TabNewMessageBackground = QBrush(getColor(hue, 0.5, 0.2), Qt::DiagCrossPattern);
if (hasDarkBorder) {
// TabText = QColor(210, 210, 210);
// TabHoverText = QColor(210, 210, 210);
TabText = QColor(0, 0, 0); TabText = QColor(0, 0, 0);
} TabBackground = QColor(255, 255, 255);
TabHoverText = QColor(0, 0, 0); TabHoverText = QColor(0, 0, 0);
TabHoverBackground = getColor(hue, 0, 0.05);
} else {
// Ubuntu style
// TODO: add setting for this
TabText = QColor(210, 210, 210);
TabBackground = QColor(61, 60, 56);
TabHoverText = QColor(210, 210, 210);
TabHoverBackground = QColor(73, 72, 68);
}
TabSelectedText = QColor(255, 255, 255); TabSelectedText = QColor(255, 255, 255);
TabSelectedBackground = getColor(hue, 0.5, 0.5);
TabHighlightedText = QColor(0, 0, 0); TabHighlightedText = QColor(0, 0, 0);
TabHighlightedBackground = getColor(hue, 0.5, 0.2);
TabNewMessageBackground = QBrush(getColor(hue, 0.5, 0.2), Qt::DiagCrossPattern);
// Chat // Chat
ChatBackground = getColor(0, 0.1, 1); ChatBackground = getColor(0, 0.1, 1);
@ -98,7 +101,9 @@ void ColorScheme::setColors(double hue, double multiplier)
ChatHeaderBorder = getColor(0, 0.1, 0.85); ChatHeaderBorder = getColor(0, 0.1, 0.85);
ChatInputBackground = getColor(0, 0.1, 0.95); ChatInputBackground = getColor(0, 0.1, 0.95);
ChatInputBorder = getColor(0, 0.1, 0.9); ChatInputBorder = getColor(0, 0.1, 0.9);
ChatSeperator = lightTheme ? QColor(127, 127, 127) : QColor(80, 80, 80);
// Scrollbar
ScrollbarBG = ChatBackground; ScrollbarBG = ChatBackground;
ScrollbarThumb = getColor(0, 0.1, 0.85); ScrollbarThumb = getColor(0, 0.1, 0.85);
ScrollbarThumbSelected = getColor(0, 0.1, 0.7); ScrollbarThumbSelected = getColor(0, 0.1, 0.7);
@ -115,15 +120,16 @@ void ColorScheme::setColors(double hue, double multiplier)
void ColorScheme::normalizeColor(QColor &color) void ColorScheme::normalizeColor(QColor &color)
{ {
if (this->lightTheme) { if (this->lightTheme) {
// TODO: write some codes
} else { } else {
if (color.lightnessF() < 0.5f) { if (color.lightnessF() < 0.5f) {
color.setHslF(color.hueF(), color.saturationF(), 0.5f); color.setHslF(color.hueF(), color.saturationF(), 0.5f);
} }
if (color.lightnessF() < 0.6f && color.hueF() > 0.54444 && color.hueF() < 0.83333) { if (color.lightnessF() < 0.6f && color.hueF() > 0.54444 && color.hueF() < 0.83333) {
color.setHslF( color.setHslF(color.hueF(), color.saturationF(),
color.hueF(), color.saturationF(), color.lightnessF() +
color.lightnessF() + sin((color.hueF() - 0.54444) / (0.8333 - 0.54444) * 3.14159) * sin((color.hueF() - 0.54444) / (0.8333 - 0.54444) * 3.14159) *
color.saturationF() * 0.2); color.saturationF() * 0.2);
} }
} }

View file

@ -27,6 +27,7 @@ public:
QColor TooltipBackground; QColor TooltipBackground;
QColor TooltipText; QColor TooltipText;
QColor ChatSeperator; QColor ChatSeperator;
QColor ChatBackground; QColor ChatBackground;
QColor ChatBackgroundHighlighted; QColor ChatBackgroundHighlighted;
@ -55,16 +56,19 @@ public:
QColor ScrollbarThumbSelected; QColor ScrollbarThumbSelected;
QColor ScrollbarArrow; QColor ScrollbarArrow;
QColor TabPanelBackground;
QColor TabBackground;
QColor TabHoverBackground;
QColor TabSelectedBackground;
QColor TabHighlightedBackground;
QBrush TabNewMessageBackground;
QColor TabText; QColor TabText;
QColor TabBackground;
QColor TabHoverText; QColor TabHoverText;
QColor TabHoverBackground;
QColor TabSelectedText; QColor TabSelectedText;
QColor TabSelectedBackground;
QColor TabHighlightedText; QColor TabHighlightedText;
QColor TabHighlightedBackground;
QBrush TabNewMessageBackground;
const int HighlightColorCount = 3; const int HighlightColorCount = 3;
QColor HighlightColors[3]; QColor HighlightColors[3];

View file

@ -169,7 +169,7 @@ void MainWindow::closeEvent(QCloseEvent *)
void MainWindow::refreshTheme() void MainWindow::refreshTheme()
{ {
QPalette palette; QPalette palette;
palette.setColor(QPalette::Background, this->colorScheme.TabPanelBackground); palette.setColor(QPalette::Background, this->colorScheme.TabBackground);
this->setPalette(palette); this->setPalette(palette);
} }

View file

@ -23,7 +23,7 @@ void NotebookButton::paintEvent(QPaintEvent *)
QColor background; QColor background;
QColor foreground; QColor foreground;
background = this->colorScheme.TabPanelBackground; background = this->colorScheme.TabBackground;
if (mouseDown) { if (mouseDown) {
// background = this->colorScheme.TabSelectedBackground; // background = this->colorScheme.TabSelectedBackground;

View file

@ -369,8 +369,7 @@ void NotebookPage::paintEvent(QPaintEvent *)
painter.setPen(this->colorScheme.Text); painter.setPen(this->colorScheme.Text);
painter.drawText(rect(), "Add Chat", QTextOption(Qt::AlignCenter)); painter.drawText(rect(), "Add Chat", QTextOption(Qt::AlignCenter));
} else { } else {
// painter.fillRect(rect(), this->colorScheme.TabSelectedBackground); painter.fillRect(rect(), this->colorScheme.ChatSeperator);
painter.fillRect(rect(), QColor(127, 127, 127));
painter.fillRect(0, 0, width(), 2, this->colorScheme.TabSelectedBackground); painter.fillRect(0, 0, width(), 2, this->colorScheme.TabSelectedBackground);
} }