About
Along with the ColorSwatchData and ColorSwatchGroup types these utility functions were introduced to handle colors. The functions are defined in the lib_colorchooser.h
header file.
String Conversion
These functions convert a given RGB color value to a formatted String:
GeData data;
const Vector color = data.GetVector();
NONE
Definition: asset_browser.h:1
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:69
#define ApplicationOutput(formatString,...)
Definition: debugdiagnostics.h:204
String ColorRGBToString(const Vector &color)
String ColorHSVToString(const Vector &color)
#define ConstDescID(...)
Definition: lib_description.h:592
@ MATERIAL_COLOR_COLOR
Definition: mmaterial.h:56
maxon::Vec3< maxon::Float64, 1 > Vector
Definition: ge_math.h:140
Color Format Conversion
The following functions allow easy conversion of colors stored in different formats.
These functions convert float colors (0.0 ... 1.0) to 8-bit colors (0 .. 255):
These functions convert float colors (0.0 ... 1.0) to 16-bit colors (0 .. 65536):
Also, a Kelvin color temperature can be converted:
const Float kelvin = 2600.0;
Vector ColorKelvinTemperatureToRGB(Float kelvinDegrees, Float tint=0.0)
maxon::Float Float
Definition: ge_sys_math.h:57
@ LIGHT_COLOR
Definition: olight.h:6
Color Harmony
These functions are used to calculate color palettes based on the given input color.
- Note
- The output maxon::BaseArray contains also the original color.
GeData data;
const Vector color = data.GetVector();
const Vector complementaryColor = results[1];
BaseMaterial*
const newMaterial = BaseMaterial::Alloc(
Mmaterial);
if (newMaterial == nullptr)
doc->InsertMaterial(newMaterial);
Definition: basearray.h:415
MAXON_ATTRIBUTE_FORCE_INLINE Int GetCount() const
Gets the number of array elements.
Definition: basearray.h:585
#define Mmaterial
Standard material.
Definition: ge_prepass.h:1007
Bool ColorHarmonyGetComplementary(const Vector &color, Bool ryb, maxon::BaseArray< Vector > &palette)
const char * doc
Definition: pyerrors.h:226
Further Reading