Colors
PBNamedColor
Enumeration/bitset of type uint16_t:
Constants
PBNamedColor_FIXED_BLACK
PBNamedColor_FIXED_BLACK = 0
PBNamedColor_FIXED_DARK_GRAY
PBNamedColor_FIXED_DARK_GRAY = 1
PBNamedColor_FIXED_GRAY
PBNamedColor_FIXED_GRAY = 2
PBNamedColor_FIXED_LIGHT_GRAY
PBNamedColor_FIXED_LIGHT_GRAY = 3
PBNamedColor_FIXED_WHITE
PBNamedColor_FIXED_WHITE = 4
PBNamedColor_FIXED_RED
PBNamedColor_FIXED_RED = 5
PBNamedColor_FIXED_YELLOW
PBNamedColor_FIXED_YELLOW = 6
PBNamedColor_FIXED_GREEN
PBNamedColor_FIXED_GREEN = 7
PBNamedColor_FIXED_CYAN
PBNamedColor_FIXED_CYAN = 8
PBNamedColor_FIXED_BLUE
PBNamedColor_FIXED_BLUE = 9
PBNamedColor_FIXED_MAGENTA
PBNamedColor_FIXED_MAGENTA = 10
PBNamedColor_ERROR_BACKGROUND
PBNamedColor_ERROR_BACKGROUND = 11
PBNamedColor_ERROR_TEXT
PBNamedColor_ERROR_TEXT = 12
PBNamedColor_WARNING_BACKGROUND
PBNamedColor_WARNING_BACKGROUND = 13
PBNamedColor_WARNING_TEXT
PBNamedColor_WARNING_TEXT = 14
PBNamedColor_SUCCESS_BACKGROUND
PBNamedColor_SUCCESS_BACKGROUND = 15
PBNamedColor_SUCCESS_TEXT
PBNamedColor_SUCCESS_TEXT = 16
PBNamedColor_HYPERLINK_TEXT
PBNamedColor_HYPERLINK_TEXT = 17
PBNamedColor_TERMINAL_BACKGROUND
PBNamedColor_TERMINAL_BACKGROUND = 18
PBNamedColor_TERMINAL_TEXT_5
PBNamedColor_TERMINAL_TEXT_5 = 19
PBNamedColor_TERMINAL_TEXT_6
PBNamedColor_TERMINAL_TEXT_6 = 20
PBNamedColor_TERMINAL_TEXT_7
PBNamedColor_TERMINAL_TEXT_7 = 21
PBNamedColor_FOCUS_RING
PBNamedColor_FOCUS_RING = 24
PBNamedColor_WINDOW_TEXT
PBNamedColor_WINDOW_TEXT = 25
PBNamedColor_BUTTON_TEXT
PBNamedColor_BUTTON_TEXT = 26
PBNamedColor_BORDER
PBNamedColor_BORDER = 27
PBNamedColor_TEXT_SELECTION
PBNamedColor_TEXT_SELECTION = 28
PBNamedColor_WINDOW_BACKGROUND
PBNamedColor_WINDOW_BACKGROUND = 29
PBNamedColor_SECOND_BACKGROUND
PBNamedColor_SECOND_BACKGROUND = 30
PBNamedColor_THIRD_BACKGROUND
PBNamedColor_THIRD_BACKGROUND = 31
PBNamedColor_POPUP_BACKGROUND
PBNamedColor_POPUP_BACKGROUND = 32
PBNamedColor_BUTTON_BACKGROUND
PBNamedColor_BUTTON_BACKGROUND = 33
PBNamedColor_SEPARATOR
PBNamedColor_SEPARATOR = 34
PBNamedColor_SECOND_TEXT
PBNamedColor_SECOND_TEXT = 35
PBNamedColor_CONTROL_TEXT
PBNamedColor_CONTROL_TEXT = 36
PBNamedColor_UNFOCUSED_TEXT_SELECTION
PBNamedColor_UNFOCUSED_TEXT_SELECTION = 37
PBNamedColor_COUNT
PBNamedColor_COUNT = 38
PBColor
Structure:
Fields
colorSpace (PBColorSpaceID):
_unused0 (uint8_t
):
_unused1 (uint16_t
):
opacity (float
):
channel0 (float
):
channel1 (float
):
channel2 (float
):
channel3 (float
):
channel4 (float
):
channel5 (float
):
PBColorFromSRGB8
Function: Populate a PBColor structure from a SRGB value with 8 bits per channel.
Syntax (C/C++)
PBColor PBColorFromSRGB8(uint32_t argb);
Syntax (Python)
ColorFromSRGB8(argb) -> (color)
Parameters and Return Values
[in] argb (uint32_t
): A 32-bit color value in the SRGB color space. The most significant 8 bits give the opacity, the next 8 bits give the red channel value, the next 8 bits give the green channel value, and the least significant 8 bits give the blue channel value. For each channel, 0 is the minimum and 255 is the maximum.
[out] color (PBColor): A PBColor structure populated to represent the given color.
Discussion
When drawing with the PBColor, the SRGB values will be mapped to the color space of the target PBRenderSurface. The returned PBColor does not need to be deallocated or released.
Example (C/C++)
PBColor opaqueRed = PBColorFromSRGB8(0xFFFF0000);
PBColor translucentCyan = PBColorFromSRGB8(0x7F00FFFF);
See Also
PBColorFromP3F
Function: Populate a PBColor structure from a Display P3 value with a float per channel.
Syntax (C/C++)
PBColor PBColorFromP3F(float r, float g, float b, float a);
Syntax (Python)
ColorFromP3F(r, g, b, a) -> (color)
Parameters and Return Values
[in] r (float
): The red channel, from 0 to 1 inclusive.
[in] g (float
): The green channel, from 0 to 1 inclusive.
[in] b (float
): The blue channel, from 0 to 1 inclusive.
[in] a (float
): The alpha channel, from 0 (completely transparent) to 1 (completely opaque) inclusive.
[out] color (PBColor): A PBColor structure populated to represent the given color.
Discussion
When drawing with the PBColor, the Display P3 values will be mapped to the color space of the target PBRenderSurface. The returned PBColor does not need to be deallocated or released.
Example (C/C++)
PBColor opaqueRed = PBColorFromP3F(1, 0, 0, 1);
See Also
PBColorFromSRGBF
Function: Populate a PBColor structure from a SRGB value with a float per channel.
Syntax (C/C++)
PBColor PBColorFromSRGBF(float r, float g, float b, float a);
Syntax (Python)
ColorFromSRGBF(r, g, b, a) -> (color)
Parameters and Return Values
[in] r (float
): The red channel, from 0 to 1 inclusive.
[in] g (float
): The green channel, from 0 to 1 inclusive.
[in] b (float
): The blue channel, from 0 to 1 inclusive.
[in] a (float
): The alpha channel, from 0 (completely transparent) to 1 (completely opaque) inclusive.
[out] color (PBColor): A PBColor structure populated to represent the given color.
Discussion
When drawing with the PBColor, the SRGB values will be mapped to the color space of the target PBRenderSurface. The returned PBColor does not need to be deallocated or released.
Example (C/C++)
PBColor opaqueGreen = PBColorFromSRGBF(0, 1, 0, 1);
See Also
PBColorFromName
Function: Populate a PBColor structure for a specific named color.
Syntax (C/C++)
PBColor PBColorFromName(PBNamedColor namedColor);
Syntax (Python)
ColorFromName(namedColor) -> (color)
Parameters and Return Values
[in] namedColor (PBNamedColor): The constant representing the color.
[out] color (PBColor): A PBColor structure populated to represent the given color.
Discussion
Some of the named colors are determined by the currently loaded interface theme. If the interface theme changes, any colors returned by this function will automatically update. The returned PBColor does not need to be deallocated or released.
Example (C/C++)
PBColor opaqueRed = PBColorFromName(PBNamedColor_ADAPTIVE_RED);
See Also
PBColorTransparent
Function: Populate a PBColor structure so that it represents the absence of color.
Syntax (C/C++)
PBColor PBColorTransparent();
Syntax (Python)
ColorTransparent() -> (color)
Parameters and Return Values
[out] color (PBColor): A PBColor structure populated to represent a completely transparent color.
Example (C/C++)
PBDrawBox(painter, rectangle, PBColorTransparent() /* no fill */,
PBColorFromSRGB8(0xFFFF0000) /* red border */, 2, 0, 0);
See Also
PBColorConversionMode
Enumeration/bitset of type uint32_t:
Constants
PBColorConversionMode_DEFAULT
PBColorConversionMode_DEFAULT = 0
PBColorConvert
Function: Convert a color from one color space to another.
Syntax (C/C++)
PBColor PBColorConvert(PBColor oldColor, PBColorSpaceID newColorSpaceID,
PBColorConversionMode mode);
Syntax (Python)
ColorConvert(oldColor, newColorSpaceID, mode) -> (newColor)
Parameters and Return Values
[in] oldColor (PBColor): The original color.
[in] newColorSpaceID (PBColorSpaceID): The new color space to convert into.
[in] mode (PBColorConversionMode): The mode of color conversion.
[out] newColor (PBColor): The new, converted color.
Discussion
The color space PBColorSpaceID_NAMED cannot be the new color space.