UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
StyleColors.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "Containers/Array.h"
7#include "CoreMinimal.h"
8#include "HAL/Platform.h"
10#include "Math/Color.h"
11#include "Misc/Guid.h"
12#include "SlateColor.h"
13#include "UObject/Object.h"
16
17#include "StyleColors.generated.h"
18
19struct FSlateColor;
20
22#define ALLOW_THEMES WITH_EDITOR || IS_PROGRAM
23
24// HEX Colors from sRGB Color space
25#define COLOR( HexValue ) FLinearColor::FromSRGBColor(FColor::FromHex(HexValue))
26
30UENUM()
104
105USTRUCT()
107{
109
110 UPROPERTY(EditAnywhere, Config, Category = Colors)
112
114};
115
119USTRUCT()
121{
123
124
127 FText DisplayName;
129 FString Filename;
131 TArray<FLinearColor> LoadedDefaultColors;
132
133 bool operator==(const FStyleTheme& Other) const
134 {
135 return Id == Other.Id;
136 }
137
138 bool operator==(const FGuid& OtherId) const
139 {
140 return Id == OtherId;
141 }
142};
143
144UCLASS(Config=EditorSettings, MinimalAPI)
146{
148public:
153
155 {
156 return ActiveColors.StyleColors[static_cast<int32>(Color)];
157 }
158
160 {
161 return CurrentThemeId;
162 }
163
165
169 SLATECORE_API void InitalizeDefaults();
170
175 {
176#if ALLOW_THEMES
177 DefaultColors[static_cast<int32>(InColorId)] = InColor;
178#else
179 ActiveColors.StyleColors[static_cast<int32>(InColorId)] = InColor;
180#endif
181 }
182
183#if ALLOW_THEMES
184
187 {
188 ActiveColors.DisplayNames[static_cast<int32>(InColorId)] = DisplayName;
189 }
190
193 {
194 return ActiveColors.DisplayNames[static_cast<int32>(InColorId)];
195 }
196
201
207 SLATECORE_API void SaveCurrentThemeAs(const FString& Filename);
208
217 SLATECORE_API bool ExportCurrentThemeTo(const FString& Filename);
218
223
228
232 SLATECORE_API bool IsEngineTheme() const;
233
237 SLATECORE_API bool IsProjectTheme() const;
238
244
251
256
260 const FStyleTheme& GetCurrentTheme() const { return *Themes.FindByKey(CurrentThemeId); }
261
265 const TArray<FStyleTheme>& GetThemes() const { return Themes; }
266
271
276
280 SLATECORE_API FString GetEngineThemeDir() const;
281
285 SLATECORE_API FString GetProjectThemeDir() const;
286
290 SLATECORE_API FString GetUserThemeDir() const;
291
295 SLATECORE_API bool DoesThemeExist(const FGuid& ThemeID) const;
296
303 FThemeChangedEvent& OnThemeChanged() { return ThemeChangedEvent; }
304
305private:
306
307 FStyleTheme& GetMutableCurrentTheme() { return *Themes.FindByKey(CurrentThemeId); }
308 SLATECORE_API void LoadThemesFromDirectory(const FString& Directory);
310 bool WriteCurrentTheme(FString& OutString);
313
314private:
318
321
322#endif // ALLOW_THEMES
323
325 {
326#if ALLOW_THEMES
327 return DefaultColors[static_cast<int32>(InColorId)];
328#else
329 return ActiveColors.StyleColors[static_cast<int32>(InColorId)];
330#endif
331 }
332
333 UPROPERTY(EditAnywhere, Config, Category=Colors)
334 FGuid CurrentThemeId;
335
336 UPROPERTY(EditAnywhere, transient, Category = Colors)
337 FStyleColorList ActiveColors;
338};
339
345{
364
369
374
379
381
394
398};
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define DECLARE_EVENT_OneParam(OwningType, EventName, Param1Type)
Definition DelegateCombinations.h:51
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define GENERATED_BODY(...)
Definition ObjectMacros.h:765
#define UCLASS(...)
Definition ObjectMacros.h:776
#define UENUM(...)
Definition ObjectMacros.h:749
#define USTRUCT(...)
Definition ObjectMacros.h:746
EStyleColor
Definition StyleColors.h:32
uint8_t uint8
Definition binka_ue_file_header.h:8
Definition Text.h:385
Definition Array.h:670
Definition Object.h:95
Definition StyleColors.h:146
const FGuid & GetCurrentThemeID() const
Definition StyleColors.h:159
FLinearColor GetDefaultColor(EStyleColor InColorId)
Definition StyleColors.h:324
void SetDefaultColor(EStyleColor InColorId, FLinearColor InColor)
Definition StyleColors.h:174
const FLinearColor & GetColor(EStyleColor Color) const
Definition StyleColors.h:154
static USlateThemeManager & Get()
Definition StyleColors.h:149
Definition Guid.h:109
Definition Color.h:48
static CORE_API const FLinearColor Transparent
Definition Color.h:459
Definition SlateColor.h:42
Definition StyleColors.h:107
Definition StyleColors.h:345
static SLATECORE_API const FSlateColor SelectHover
Definition StyleColors.h:378
static SLATECORE_API const FSlateColor PrimaryPress
Definition StyleColors.h:367
static SLATECORE_API const FSlateColor Foldout
Definition StyleColors.h:350
static SLATECORE_API const FSlateColor White25
Definition StyleColors.h:362
static SLATECORE_API const FSlateColor Secondary
Definition StyleColors.h:368
static SLATECORE_API const FSlateColor Highlight
Definition StyleColors.h:363
static SLATECORE_API const FSlateColor AccentBrown
Definition StyleColors.h:389
static SLATECORE_API const FSlateColor Panel
Definition StyleColors.h:355
static SLATECORE_API const FSlateColor Transparent
Definition StyleColors.h:346
static SLATECORE_API const FSlateColor White
Definition StyleColors.h:361
static SLATECORE_API const FSlateColor AccentPink
Definition StyleColors.h:384
static SLATECORE_API const FSlateColor AccentBlack
Definition StyleColors.h:390
static SLATECORE_API const FSlateColor Success
Definition StyleColors.h:397
static SLATECORE_API const FSlateColor Hover2
Definition StyleColors.h:360
static SLATECORE_API const FSlateColor Background
Definition StyleColors.h:354
static SLATECORE_API const FSlateColor Foreground
Definition StyleColors.h:370
static SLATECORE_API const FSlateColor Black
Definition StyleColors.h:347
static SLATECORE_API const FSlateColor AccentRed
Definition StyleColors.h:385
static SLATECORE_API const FSlateColor WindowBorder
Definition StyleColors.h:349
static SLATECORE_API const FSlateColor Input
Definition StyleColors.h:351
static SLATECORE_API const FSlateColor PrimaryHover
Definition StyleColors.h:366
static SLATECORE_API const FSlateColor AccentWhite
Definition StyleColors.h:392
static SLATECORE_API const FSlateColor AccentOrange
Definition StyleColors.h:386
static SLATECORE_API const FSlateColor AccentGray
Definition StyleColors.h:391
static SLATECORE_API const FSlateColor Error
Definition StyleColors.h:396
static SLATECORE_API const FSlateColor Hover
Definition StyleColors.h:359
static SLATECORE_API const FSlateColor Title
Definition StyleColors.h:348
static SLATECORE_API const FSlateColor Select
Definition StyleColors.h:375
static SLATECORE_API const FSlateColor AccentYellow
Definition StyleColors.h:387
static SLATECORE_API const FSlateColor AccentFolder
Definition StyleColors.h:393
static SLATECORE_API const FSlateColor Primary
Definition StyleColors.h:365
static SLATECORE_API const FSlateColor ForegroundHeader
Definition StyleColors.h:373
static SLATECORE_API const FSlateColor AccentPurple
Definition StyleColors.h:383
static SLATECORE_API const FSlateColor Warning
Definition StyleColors.h:395
static SLATECORE_API const FSlateColor SelectParent
Definition StyleColors.h:377
static SLATECORE_API const FSlateColor ForegroundInverted
Definition StyleColors.h:372
static SLATECORE_API const FSlateColor Recessed
Definition StyleColors.h:353
static SLATECORE_API const FSlateColor AccentGreen
Definition StyleColors.h:388
static SLATECORE_API const FSlateColor Dropdown
Definition StyleColors.h:357
static SLATECORE_API const FSlateColor Notifications
Definition StyleColors.h:380
static SLATECORE_API const FSlateColor Header
Definition StyleColors.h:356
static SLATECORE_API const FSlateColor DropdownOutline
Definition StyleColors.h:358
static SLATECORE_API const FSlateColor AccentBlue
Definition StyleColors.h:382
static SLATECORE_API const FSlateColor SelectInactive
Definition StyleColors.h:376
static SLATECORE_API const FSlateColor ForegroundHover
Definition StyleColors.h:371
static SLATECORE_API const FSlateColor InputOutline
Definition StyleColors.h:352
Definition StyleColors.h:121
bool operator==(const FGuid &OtherId) const
Definition StyleColors.h:138