TachyonUI 0.1.0
High-performance UI for building tools.
Loading...
Searching...
No Matches
tachyon::ColorPickerState Struct Reference

Persistent state of the color picker popup. More...

#include <gui_controls/subsystems/gui_color_picker_subsystem.h>

Classes

struct  PaletteSwatch

Public Types

enum class  CloseRequest { None , Ok , Cancel }
 OK keeps the color (and adds it to the recent ones), Cancel and the close button restore the one the picker opened with. More...
enum class  DragTarget { None , Square , Hue , Alpha }
 What a press on the square or a strip changes. More...

Public Attributes

tachyon::ID triggerID = tachyon::ID::Invalid()
 swatch that opened the picker
tachyon::ID windowID = tachyon::ID::Invalid()
 popup window ID
float h = 0
float s = 0
float v = 0
float a = 1
 working HSV+A copy
tachyon::color4f originalColor {}
 color when picker was opened
bool allowHDR = false
 the opening field accepts HDR colors
float hdrBrightness = 1.0f
 HDR multiplier; > 1 brightens past 1.
std::string hexText
 hex input field text
tachyon::ColorSpace activeSpace = tachyon::ColorSpace::HSV
float comp [3] = { 0, 0, 0 }
 Components of the active space (H/S/V, R/G/B, L/a/b, ...).
float snapComp [3] = { 0, 0, 0 }
 comp as last built; a difference next frame means a slider edited it.
bool slidersInitialized = false
bool byteRange = true
 Channel values shown 0-255 (and hue in degrees, S/V/L in percent), or 0-1.
bool picking = false
 The eyedropper is held: the color follows the screen under the cursor.
std::optional< bool > canPick
 whether the platform reads the screen (asked once)
std::string context
 what's being edited (the field's label), after the title
enum tachyon::ColorPickerState::CloseRequest closeRequest = CloseRequest::None
std::vector< tachyon::color4f > recent
 newest first
tachyon::VisualColorStyleIndex svQuadColor = tachyon::VisualColorStyleIndex::Invalid
tachyon::VisualColorStyleIndex hueStrip = tachyon::VisualColorStyleIndex::Invalid
tachyon::VisualColorStyleIndex alphaStrip = tachyon::VisualColorStyleIndex::Invalid
tachyon::VisualColorStyleIndex hueColor = tachyon::VisualColorStyleIndex::Invalid
 The pure hue, shown in the hue handle.
tachyon::VisualColorStyleIndex whiteColor = tachyon::VisualColorStyleIndex::Invalid
tachyon::VisualColorStyleIndex outlineColor = tachyon::VisualColorStyleIndex::Invalid
 Outline around the cursors and handles.
tachyon::VisualColorStyleIndex newColor = tachyon::VisualColorStyleIndex::Invalid
 The new color, with its alpha.
tachyon::VisualColorStyleIndex originalStyle = tachyon::VisualColorStyleIndex::Invalid
tachyon::VisualColorStyleIndex newOpaque = tachyon::VisualColorStyleIndex::Invalid
 The new color without its alpha, for the preview's top half.
tachyon::VisualColorStyleIndex originalOpaque = tachyon::VisualColorStyleIndex::Invalid
 The original color without its alpha, for the preview's top half.
tachyon::PointerDrag press
 The press on the square or a strip, a drag from the start.
float startH = 0.0f
 The color before it; put back by Escape.
float startS = 0.0f
float startV = 0.0f
float startA = 1.0f
tachyon::VisualColorStyleIndex gradientStyles [kNumGradientSliders] = {}
std::vector< PaletteSwatch > palette

Static Public Attributes

static constexpr int kNumGradientSliders = 4

Detailed Description

Persistent state of the color picker popup.

The picker opens off a ColorField swatch (triggerID), edits a working copy, and writes the result back to the caller's color. It lives across frames so the popup keeps its tab, palette and drag state while the popup is rebuilt each frame.

Member Enumeration Documentation

◆ CloseRequest

OK keeps the color (and adds it to the recent ones), Cancel and the close button restore the one the picker opened with.

Handled by the ColorField on its next frame.

Enumerator
None 
Ok 
Cancel 

◆ DragTarget

What a press on the square or a strip changes.

Enumerator
None 
Square 
Hue 
Alpha 

Member Data Documentation

◆ triggerID

tachyon::ID tachyon::ColorPickerState::triggerID = tachyon::ID::Invalid()

swatch that opened the picker

◆ windowID

tachyon::ID tachyon::ColorPickerState::windowID = tachyon::ID::Invalid()

popup window ID

◆ h

float tachyon::ColorPickerState::h = 0

◆ s

float tachyon::ColorPickerState::s = 0

◆ v

float tachyon::ColorPickerState::v = 0

◆ a

float tachyon::ColorPickerState::a = 1

working HSV+A copy

◆ originalColor

tachyon::color4f tachyon::ColorPickerState::originalColor {}

color when picker was opened

◆ allowHDR

bool tachyon::ColorPickerState::allowHDR = false

the opening field accepts HDR colors

◆ hdrBrightness

float tachyon::ColorPickerState::hdrBrightness = 1.0f

HDR multiplier; > 1 brightens past 1.

◆ hexText

std::string tachyon::ColorPickerState::hexText

hex input field text

◆ activeSpace

tachyon::ColorSpace tachyon::ColorPickerState::activeSpace = tachyon::ColorSpace::HSV

◆ comp

float tachyon::ColorPickerState::comp[3] = { 0, 0, 0 }

Components of the active space (H/S/V, R/G/B, L/a/b, ...).

Members, since the channel tracks' handlers keep pointers to them until dispatch.

◆ snapComp

float tachyon::ColorPickerState::snapComp[3] = { 0, 0, 0 }

comp as last built; a difference next frame means a slider edited it.

◆ slidersInitialized

bool tachyon::ColorPickerState::slidersInitialized = false

◆ byteRange

bool tachyon::ColorPickerState::byteRange = true

Channel values shown 0-255 (and hue in degrees, S/V/L in percent), or 0-1.

◆ picking

bool tachyon::ColorPickerState::picking = false

The eyedropper is held: the color follows the screen under the cursor.

◆ canPick

std::optional<bool> tachyon::ColorPickerState::canPick

whether the platform reads the screen (asked once)

◆ context

std::string tachyon::ColorPickerState::context

what's being edited (the field's label), after the title

◆ closeRequest

enum tachyon::ColorPickerState::CloseRequest tachyon::ColorPickerState::closeRequest = CloseRequest::None

◆ recent

std::vector<tachyon::color4f> tachyon::ColorPickerState::recent

newest first

◆ svQuadColor

◆ hueStrip

◆ alphaStrip

◆ hueColor

The pure hue, shown in the hue handle.

◆ whiteColor

◆ outlineColor

Outline around the cursors and handles.

◆ newColor

The new color, with its alpha.

◆ originalStyle

tachyon::VisualColorStyleIndex tachyon::ColorPickerState::originalStyle = tachyon::VisualColorStyleIndex::Invalid

◆ newOpaque

The new color without its alpha, for the preview's top half.

◆ originalOpaque

tachyon::VisualColorStyleIndex tachyon::ColorPickerState::originalOpaque = tachyon::VisualColorStyleIndex::Invalid

The original color without its alpha, for the preview's top half.

◆ press

tachyon::PointerDrag tachyon::ColorPickerState::press

The press on the square or a strip, a drag from the start.

◆ startH

float tachyon::ColorPickerState::startH = 0.0f

The color before it; put back by Escape.

◆ startS

float tachyon::ColorPickerState::startS = 0.0f

◆ startV

float tachyon::ColorPickerState::startV = 0.0f

◆ startA

float tachyon::ColorPickerState::startA = 1.0f

◆ kNumGradientSliders

int tachyon::ColorPickerState::kNumGradientSliders = 4
staticconstexpr

◆ gradientStyles

tachyon::VisualColorStyleIndex tachyon::ColorPickerState::gradientStyles[kNumGradientSliders] = {}

◆ palette

std::vector<PaletteSwatch> tachyon::ColorPickerState::palette
Initial value:
= {
{{ 0.8f, 0.8f, 0.8f, 1.0f }},
{{ 0.0f, 0.8f, 0.8f, 1.0f }},
{{ 0.8f, 0.0f, 0.8f, 1.0f }},
{{ 0.8f, 0.8f, 0.0f, 1.0f }},
}

The documentation for this struct was generated from the following file: