malena
Why malena
Quick start
Tutorials
API docs
GitHub
GitHub
Tutorials
Loading...
Searching...
No Matches
Manifests
Theme.h
Go to the documentation of this file.
1
//
2
// Theme.h
3
//
4
5
#ifndef MALENA_THEME_H
6
#define MALENA_THEME_H
7
8
#pragma once
9
10
// #include <Malena/Resources/FontManager.h>
11
#include <
Malena/Core/malena_export.h
>
12
#include <
SFML/Graphics/Color.hpp
>
13
#include <
Malena/Manifests/ThemeTag.h
>
14
#include <
SFML/Graphics/Font.hpp
>
15
namespace
ml
16
{
17
// ── Theme ─────────────────────────────────────────────────────────────────
18
69
struct
Theme
:
ThemeTag
70
{
71
// ── Color roles ───────────────────────────────────────────────────────
72
74
sf::Color
primary
=
sf::Color
(100, 60, 200);
75
77
sf::Color
secondary
=
sf::Color
(70, 130, 230);
78
80
sf::Color
surface
=
sf::Color
(40, 40, 40);
81
83
sf::Color
background
=
sf::Color
(20, 20, 20);
84
86
sf::Color
onSurface
=
sf::Color::White
;
87
89
sf::Color
onPrimary
=
sf::Color::White
;
90
92
sf::Color
onBackground
=
sf::Color
(220, 220, 220);
93
95
sf::Color
muted
=
sf::Color
(120, 120, 120);
96
98
sf::Color
border
=
sf::Color
(100, 100, 100);
99
101
sf::Color
borderFocus
=
sf::Color
(100, 60, 200);
102
104
sf::Color
error
=
sf::Color
(220, 70, 70);
105
107
sf::Color
success
=
sf::Color
(70, 200, 100);
108
110
sf::Color
disabled
=
sf::Color
(60, 60, 60);
111
113
sf::Color
onDisabled
=
sf::Color
(120, 120, 120);
114
115
// ── Typography ────────────────────────────────────────────────────────
116
118
const
sf::Font
*
font
=
nullptr
;
119
121
unsigned
int
fontSize
= 14;
122
124
unsigned
int
fontSizeSmall
= 11;
125
127
unsigned
int
fontSizeLarge
= 18;
128
129
// ── Geometry ─────────────────────────────────────────────────────────
130
132
float
radius
= 8.f;
133
135
float
spacing
= 8.f;
136
138
float
borderThickness
= 1.5f;
139
140
// ── Virtual destructor for safe inheritance ───────────────────────────
141
virtual
~Theme
() =
default
;
142
};
143
144
// ── Built-in themes ───────────────────────────────────────────────────────
145
154
struct
DarkTheme
:
Theme
155
{
156
DarkTheme
()
157
{
158
primary
=
sf::Color
(100, 60, 200);
159
secondary
=
sf::Color
(70, 130, 230);
160
surface
=
sf::Color
(40, 40, 40);
161
background
=
sf::Color
(20, 20, 20);
162
onSurface
=
sf::Color::White
;
163
onPrimary
=
sf::Color::White
;
164
onBackground
=
sf::Color
(220, 220, 220);
165
muted
=
sf::Color
(120, 120, 120);
166
border
=
sf::Color
(100, 100, 100);
167
borderFocus
=
sf::Color
(100, 60, 200);
168
error
=
sf::Color
(220, 70, 70);
169
success
=
sf::Color
(70, 200, 100);
170
disabled
=
sf::Color
(60, 60, 60);
171
onDisabled
=
sf::Color
(120, 120, 120);
172
radius
= 8.f;
173
spacing
= 8.f;
174
borderThickness
= 1.5f;
175
}
176
};
177
183
struct
LightTheme
:
Theme
184
{
185
LightTheme
()
186
{
187
primary
=
sf::Color
(100, 60, 200);
188
secondary
=
sf::Color
(70, 130, 230);
189
surface
=
sf::Color
(245, 245, 248);
190
background
=
sf::Color
(255, 255, 255);
191
onSurface
=
sf::Color
(20, 20, 20);
192
onPrimary
=
sf::Color::White
;
193
onBackground
=
sf::Color
(40, 40, 40);
194
muted
=
sf::Color
(150, 150, 150);
195
border
=
sf::Color
(200, 200, 200);
196
borderFocus
=
sf::Color
(100, 60, 200);
197
error
=
sf::Color
(200, 50, 50);
198
success
=
sf::Color
(50, 180, 80);
199
disabled
=
sf::Color
(220, 220, 220);
200
onDisabled
=
sf::Color
(160, 160, 160);
201
radius
= 8.f;
202
spacing
= 8.f;
203
borderThickness
= 1.f;
204
}
205
};
206
207
}
// namespace ml
208
209
#endif
// MALENA_THEME_H
Color.hpp
Font.hpp
ThemeTag.h
sf::Color
sf::Color::White
static const Color White
sf::Font
malena_export.h
ml
Definition
Component.h:22
ml::DarkTheme::DarkTheme
DarkTheme()
Definition
Theme.h:156
ml::LightTheme::LightTheme
LightTheme()
Definition
Theme.h:185
ml::Theme
Universal design token set applied across all Themeable components.
Definition
Theme.h:70
ml::Theme::border
sf::Color border
Definition
Theme.h:98
ml::Theme::~Theme
virtual ~Theme()=default
ml::Theme::spacing
float spacing
Definition
Theme.h:135
ml::Theme::fontSize
unsigned int fontSize
Definition
Theme.h:121
ml::Theme::success
sf::Color success
Definition
Theme.h:107
ml::Theme::onPrimary
sf::Color onPrimary
Definition
Theme.h:89
ml::Theme::error
sf::Color error
Definition
Theme.h:104
ml::Theme::borderThickness
float borderThickness
Definition
Theme.h:138
ml::Theme::font
const sf::Font * font
Definition
Theme.h:118
ml::Theme::fontSizeSmall
unsigned int fontSizeSmall
Definition
Theme.h:124
ml::Theme::primary
sf::Color primary
Definition
Theme.h:74
ml::Theme::onSurface
sf::Color onSurface
Definition
Theme.h:86
ml::Theme::radius
float radius
Definition
Theme.h:132
ml::Theme::background
sf::Color background
Definition
Theme.h:83
ml::Theme::disabled
sf::Color disabled
Definition
Theme.h:110
ml::Theme::muted
sf::Color muted
Definition
Theme.h:95
ml::Theme::onDisabled
sf::Color onDisabled
Definition
Theme.h:113
ml::Theme::borderFocus
sf::Color borderFocus
Definition
Theme.h:101
ml::Theme::onBackground
sf::Color onBackground
Definition
Theme.h:92
ml::Theme::surface
sf::Color surface
Definition
Theme.h:80
ml::Theme::secondary
sf::Color secondary
Definition
Theme.h:77
ml::Theme::fontSizeLarge
unsigned int fontSizeLarge
Definition
Theme.h:127
ml::ThemeTag
Lightweight polymorphic base for all Theme structs.
Definition
ThemeTag.h:27