Plasma Engine  2.0
Loading...
Searching...
No Matches
plColorScheme 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 , PlasmaBranding , Black , Count
}
 
enum class  CategoryColorUsage {
  ViewportIcon , MenuEntryIcon , SceneTreeIcon , OverlayIcon ,
  BorderColor , BorderIconColor , AssetMenuIcon
}
 
using CategoryColorFunc = plColor (*)(plStringView sCategory, CategoryColorUsage usage)
 

Static Public Member Functions

static PL_FORCE_INLINE plColor GetColor (Enum schemeColor, plUInt8 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 plColor GetColor (float fIndex, plUInt8 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 PL_ALWAYS_INLINE plColor DarkUI (Enum schemeColor)
 Get a scheme color with predefined brightness and saturation to look good with the PL tools dark UI scheme.
 
static PL_FORCE_INLINE plColor DarkUI (float fIndex)
 Gets a scheme color by index with predefined brightness and saturation to look good with the PL tools dark UI scheme.
 
static PL_ALWAYS_INLINE plColor LightUI (Enum schemeColor)
 Get a scheme color with predefined brightness and saturation to look good as highlight color in PL tools. Can also be used in a 3D scene for e.g. visualizers etc.
 
static PL_FORCE_INLINE plColor LightUI (float fIndex)
 Get a scheme color by index with predefined brightness and saturation to look good as highlight color in PL tools. Can also be used in a 3D scene for e.g. visualizers etc.
 
static plColor GetCategoryColor (plStringView sCategory, CategoryColorUsage usage)
 Returns a color to use in UI for elements of a given 'category'.
 

Static Public Attributes

static constexpr float s_fIndexNormalizer = 1.0f / (Count - 2)
 Normalization factor for getting colors by index. E.g. plColorScheme::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()

plColor plColorScheme::GetCategoryColor ( plStringView sCategory,
CategoryColorUsage usage )
static

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

The category is typically defined via an plCategoryAttribute. 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: