Krita Source Code Documentation
Loading...
Searching...
No Matches
KisAnimTimelineColors.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2015 Dmitry Kazakov <dimula73@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
8
9#include <QApplication>
10#include <QColor>
11#include <QBrush>
12#include <QPalette>
13#include <QFont>
14#include <QFontMetrics>
15
16#include "kis_debug.h"
17#include "krita_utils.h"
18
19#include <QGlobalStatic>
21
22
26
30
35
37{
38 return QColor(223, 148, 51);
39}
40
42{
43 //return qApp->palette().color(QPalette::Highlight);
44 return selectorColor();
45}
46
48{
49 QColor color = qApp->palette().color(QPalette::Highlight);
50 return color;
51}
52
54{
55 return qApp->palette().brush(QPalette::Button);
56}
57
59{
60 QColor bgColor = qApp->palette().color(QPalette::Base);
61 int darkenCoeff = bgColor.value() > 128 ? 150 : 50;
62 return headerEmpty().color().darker(darkenCoeff);
63}
64
66{
67 return selectorColor();
68}
69
71{
72 return qApp->palette().color(QPalette::Highlight);
73}
74
76{
77 return qApp->palette().color(QPalette::Disabled, QPalette::HighlightedText);
78}
79
81{
82 QColor bgColor = qApp->palette().color(QPalette::Base);
83 const int lighterCoeff = bgColor.value() > 128 ? 120 : 80;
84 return qApp->palette().color(QPalette::Highlight).lighter(lighterCoeff);
85}
86
87QFont KisAnimTimelineColors::getOnionSkinsFont(const QString &maxString, const QSize &availableSize) const
88{
89 QFont font = qApp->font();
90
91 // Font size may be in pixels (on Android) or points (everywhere else.)
92 bool inPoints = font.pixelSize() == -1;
93 while((inPoints ? font.pointSize() : font.pixelSize()) > 8) {
94 QFontMetrics fm(font);
95
96 QRect rc = fm.boundingRect(maxString);
97
98 if (rc.width() > availableSize.width() ||
99 rc.height() > availableSize.height()) {
100
101 if (inPoints) {
102 font.setPointSize(font.pointSize() - 1);
103 } else {
104 font.setPixelSize(font.pixelSize() - 1);
105 }
106 } else {
107 break;
108 }
109 }
110
111 return font;
112}
Q_GLOBAL_STATIC(KisStoragePluginRegistry, s_instance)
QColor onionSkinsSliderEnabledColor() const
QFont getOnionSkinsFont(const QString &maxString, const QSize &availableSize) const
QColor onionSkinsSliderDisabledColor() const
static KisAnimTimelineColors * instance()