ezEngine  Release 25.03
ezColorScheme Class Reference

A color scheme based on https://github.com/yeun/open-color version 1.9.1. More...

#include <ColorScheme.h>

Public Types

enum  Enum {
  Red, Pink, Grape, Violet,
  Indigo, Blue, Cyan, Teal,
  Green, Lime, Yellow, Orange,
  Gray, Count
}
 
enum  CategoryColorUsage {
  ViewportIcon, MenuEntryIcon, SceneTreeIcon, OverlayIcon,
  BorderColor, BorderIconColor, AssetMenuIcon
}
 
using CategoryColorFunc = ezColor(*)(ezStringView sCategory, CategoryColorUsage usage)
 

Static Public Member Functions

static EZ_FORCE_INLINE ezColor GetColor (Enum schemeColor, ezUInt8 uiBrightness, float fSaturation=1.0f, float fAlpha=1.0f)
 Get the scheme color with the given brightness (0..9) and with optional saturation and alpha.
 
static ezColor GetColor (float fIndex, ezUInt8 uiBrightness, float fSaturation=1.0f, float fAlpha=1.0f)
 Get the scheme color using a floating point index instead of the enum. The resulting color will be interpolated between the predefined ones. Does not include gray.
 
static EZ_ALWAYS_INLINE ezColor DarkUI (Enum schemeColor)
 Get a scheme color with predefined brightness and saturation to look good with the EZ tools dark UI scheme.
 
static EZ_FORCE_INLINE ezColor DarkUI (float fIndex)
 Gets a scheme color by index with predefined brightness and saturation to look good with the EZ tools dark UI scheme.
 
static EZ_ALWAYS_INLINE ezColor LightUI (Enum schemeColor)
 Get a scheme color with predefined brightness and saturation to look good as highlight color in EZ tools. Can also be used in a 3D scene for e.g. visualizers etc.
 
static EZ_FORCE_INLINE ezColor LightUI (float fIndex)
 Get a scheme color by index with predefined brightness and saturation to look good as highlight color in EZ tools. Can also be used in a 3D scene for e.g. visualizers etc.
 
static ezColor GetCategoryColor (ezStringView sCategory, CategoryColorUsage usage)
 Returns a color to use in UI for elements of a given 'category'. More...
 

Static Public Attributes

constexpr static float s_fIndexNormalizer = 1.0f / (Count - 2)
 Normalization factor for getting colors by index. E.g. ezColorScheme::Blue * s_fIndexNormalizer would get exactly Blue as color.
 
static CategoryColorFunc s_CategoryColorFunc = nullptr
 

Detailed Description

A color scheme based on https://github.com/yeun/open-color version 1.9.1.

Open Color Goals: All colors will be beautiful in itself and harmonious At the same brightness level, the perceived brightness will be constant

Member Enumeration Documentation

◆ CategoryColorUsage

Member Function Documentation

◆ GetCategoryColor()

ezColor ezColorScheme::GetCategoryColor ( ezStringView  sCategory,
CategoryColorUsage  usage 
)
static

Returns a color to use in UI for elements of a given 'category'.

The category is typically defined via an ezCategoryAttribute. It is simply a string. If it is a complex category, e.g. a path such as "Effects/Wind", the default implementation only looks at the first part, ie. it treats this all as the category "Effects.

A custom implementation can be provided through s_CategoryColorFunc, in which case it has full control and can also use the full category name.

The 'usage' is provided to tell the function what the color will be used for, allowing to use more or less contrast or switch of coloring entirely.


The documentation for this class was generated from the following files: