summary refs log tree commit diff
path: root/src/ui/Theme.h
blob: 4dbe03f9231e636f10fbda045e9f4cf3d1512784 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// SPDX-FileCopyrightText: 2021 Nheko Contributors
//
// SPDX-License-Identifier: GPL-3.0-or-later

#pragma once

#include <QColor>
#include <QPalette>

namespace ui {
// Default font size.
const int FontSize = 16;

// Default avatar size. Width and height.
const int AvatarSize = 40;

enum class ButtonPreset
{
    FlatPreset,
    CheckablePreset
};

enum class RippleStyle
{
    CenteredRipple,
    PositionedRipple,
    NoRipple
};

enum class OverlayStyle
{
    NoOverlay,
    TintedOverlay,
    GrayOverlay
};

enum class Role
{
    Default,
    Primary,
    Secondary
};

enum class ButtonIconPlacement
{
    LeftIcon,
    RightIcon
};

enum class ProgressType
{
    DeterminateProgress,
    IndeterminateProgress
};

} // namespace ui

class Theme : public QPalette
{
    Q_GADGET
    Q_PROPERTY(QColor sidebarBackground READ sidebarBackground CONSTANT)
    Q_PROPERTY(QColor alternateButton READ alternateButton CONSTANT)
    Q_PROPERTY(QColor separator READ separator CONSTANT)
    Q_PROPERTY(QColor red READ red CONSTANT)
    Q_PROPERTY(QColor error READ error CONSTANT)
    Q_PROPERTY(QColor orange READ orange CONSTANT)
public:
    Theme() {}
    explicit Theme(std::string_view theme);
    static QPalette paletteFromTheme(std::string_view theme);

    QColor sidebarBackground() const { return sidebarBackground_; }
    QColor alternateButton() const { return alternateButton_; }
    QColor separator() const { return separator_; }
    QColor red() const { return red_; }
    QColor error() const { return QColor(0xdd, 0x3d, 0x3d); }
    QColor orange() const { return orange_; }

private:
    QColor sidebarBackground_, separator_, red_, orange_, alternateButton_;
};