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
tags
# rapidjson directory
rapidjson/*

View file

@ -62,7 +62,7 @@ void ColorScheme::setColors(double hue, double multiplier)
SystemMessageColor = QColor(140, 127, 127);
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);
@ -71,26 +71,29 @@ void ColorScheme::setColors(double hue, double multiplier)
TextLink = lightTheme ? QColor(66, 134, 244) : QColor(66, 134, 244);
// tab
if (hasDarkBorder) {
// 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);
if (true) {
TabText = QColor(0, 0, 0);
TabBackground = QColor(255, 255, 255);
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);
}
TabHoverText = QColor(0, 0, 0);
TabSelectedText = QColor(255, 255, 255);
TabSelectedBackground = getColor(hue, 0.5, 0.5);
TabHighlightedText = QColor(0, 0, 0);
TabHighlightedBackground = getColor(hue, 0.5, 0.2);
TabNewMessageBackground = QBrush(getColor(hue, 0.5, 0.2), Qt::DiagCrossPattern);
// Chat
ChatBackground = getColor(0, 0.1, 1);
@ -98,7 +101,9 @@ void ColorScheme::setColors(double hue, double multiplier)
ChatHeaderBorder = getColor(0, 0.1, 0.85);
ChatInputBackground = getColor(0, 0.1, 0.95);
ChatInputBorder = getColor(0, 0.1, 0.9);
ChatSeperator = lightTheme ? QColor(127, 127, 127) : QColor(80, 80, 80);
// Scrollbar
ScrollbarBG = ChatBackground;
ScrollbarThumb = getColor(0, 0.1, 0.85);
ScrollbarThumbSelected = getColor(0, 0.1, 0.7);
@ -115,16 +120,17 @@ void ColorScheme::setColors(double hue, double multiplier)
void ColorScheme::normalizeColor(QColor &color)
{
if (this->lightTheme) {
// TODO: write some codes
} else {
if (color.lightnessF() < 0.5f) {
color.setHslF(color.hueF(), color.saturationF(), 0.5f);
}
if (color.lightnessF() < 0.6f && color.hueF() > 0.54444 && color.hueF() < 0.83333) {
color.setHslF(
color.hueF(), color.saturationF(),
color.lightnessF() + sin((color.hueF() - 0.54444) / (0.8333 - 0.54444) * 3.14159) *
color.saturationF() * 0.2);
color.setHslF(color.hueF(), color.saturationF(),
color.lightnessF() +
sin((color.hueF() - 0.54444) / (0.8333 - 0.54444) * 3.14159) *
color.saturationF() * 0.2);
}
}
}

View file

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

View file

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

View file

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

View file

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