3#include <Foundation/Math/Color.h>
34 constexpr static float s_fIndexNormalizer = 1.0f / (Count - 2);
37 PL_FORCE_INLINE
static plColor GetColor(Enum schemeColor, plUInt8 uiBrightness,
float fSaturation = 1.0f,
float fAlpha = 1.0f)
39 PL_ASSERT_DEV(uiBrightness <= 9,
"Brightness is too large");
40 const plColor c = s_Colors[schemeColor][uiBrightness];
47 static plColor GetColor(
float fIndex, plUInt8 uiBrightness,
float fSaturation = 1.0f,
float fAlpha = 1.0f);
52 return s_DarkUIColors[schemeColor];
58 plUInt32 uiIndexA, uiIndexB;
60 GetInterpolation(fIndex, uiIndexA, uiIndexB, fFrac);
62 return plMath::Lerp(s_DarkUIColors[uiIndexA], s_DarkUIColors[uiIndexB], fFrac);
68 return s_LightUIColors[schemeColor];
74 plUInt32 uiIndexA, uiIndexB;
76 GetInterpolation(fIndex, uiIndexA, uiIndexB, fFrac);
78 return plMath::Lerp(s_LightUIColors[uiIndexA], s_LightUIColors[uiIndexB], fFrac);
95 static CategoryColorFunc s_CategoryColorFunc;
111 PL_ALWAYS_INLINE
constexpr static void GetInterpolation(
float fIndex, plUInt32& out_uiIndexA, plUInt32& out_uiIndexB,
float& out_fFrac)
115 constexpr plUInt32 uiCountWithoutGray = Count - 1;
116 constexpr plUInt32 uiMaxIndex = uiCountWithoutGray - 1;
117 out_uiIndexA = plUInt32(fIndex * uiMaxIndex);
118 out_uiIndexB = (out_uiIndexA + 1) % uiCountWithoutGray;
119 out_fFrac = (fIndex * uiMaxIndex) - out_uiIndexA;
122 static plColor s_Colors[Count][10];
123 static plColor s_DarkUIColors[Count];
124 static plColor s_LightUIColors[Count];
plColor represents an RGBA color in linear color space. Values are stored as float,...
Definition Color.h:44
float GetLuminance() const
Computes the perceived luminance. Assumes linear color space (http://en.wikipedia....
Definition Color_inl.h:65
A color scheme based on https://github.com/yeun/open-color version 1.9.1.
Definition ColorScheme.h:11
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 s...
Definition ColorScheme.h:50
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...
Definition ColorScheme.h:72
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 to...
Definition ColorScheme.h:66
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...
Definition ColorScheme.h:56
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.
Definition ColorScheme.h:37
CategoryColorUsage
Definition ColorScheme.h:83
plStringView represent a read-only sub-string of a larger string, as it can store a dedicated string ...
Definition StringView.h:34
PL_FORCE_INLINE T Lerp(T f1, T f2, float fFactor)
Returns the linear interpolation of f1 and f2. factor is a value between 0 and 1.
Definition Math_inl.h:230
constexpr PL_ALWAYS_INLINE T Saturate(T value)
Clamps "value" to the range [0; 1]. Returns "value", if it is inside the range already.
Definition Math_inl.h:57