class Colorist

Main class for manipulation with color models

Properties

protected array $classes List of model classes
protected array $models Loaded models
protected array $channels List supported channels. Automatically generated list
protected array $types List supported types. Automatically generated list

Methods

__construct(string $value = NULL)

Colorist constructor.

static Colorist
create(string $value)

Static method for create and set

array
getChannelsList()

No description

array
getTypesList()

No description

setChannel(string $channel, string|integer|float $value)

Set one channel

float|int|string
getChannel(string $channel)

Get value of one channel

void
set(string $model, string $value)

Set model

stdClass|string
get(string $model, bool $withAlpha = false, bool $toString = false)

Get model

loadModels()

Loading models

loadChannels(array $channels)

Loading channels

loadTypes(array $types)

Loading types

string
detectParser(string $value)

Detecting the parser from the set value

array
otherParser(string $value)

Getting the model and values from other. Format: rgb(0,0,0); hsv(15,10,3)

array
hexParser(string $value)

Getting the model and values from hex. Format: #000; #112233

array
nameParser(string $value)

Getting the model and values from name. Format: orange; red

getModel(string $type)

Getting a model by type

syncModels(ModelInterface $source)

Synchronization of models

Details

at line 59
__construct(string $value = NULL)

Colorist constructor.

Parameters

string $value

Exceptions

ColoristException

at line 93
static Colorist create(string $value)

Static method for create and set

Parameters

string $value

Return Value

Colorist

at line 101
array getChannelsList()

Return Value

array

at line 109
array getTypesList()

Return Value

array

at line 122
setChannel(string $channel, string|integer|float $value)

Set one channel

Parameters

string $channel
string|integer|float $value

Exceptions

ColoristException

at line 146
float|int|string getChannel(string $channel)

Get value of one channel

Parameters

string $channel

Return Value

float|int|string

Exceptions

ColoristException

at line 172
void set(string $model, string $value)

Set model

Parameters

string $model
string $value

Return Value

void

at line 188
stdClass|string get(string $model, bool $withAlpha = false, bool $toString = false)

Get model

Parameters

string $model
bool $withAlpha
bool $toString

Return Value

stdClass|string

at line 198
protected loadModels()

Loading models

at line 215
protected loadChannels(array $channels)

Loading channels

Parameters

array $channels

at line 225
protected loadTypes(array $types)

Loading types

Parameters

array $types

at line 238
protected string detectParser(string $value)

Detecting the parser from the set value

Parameters

string $value

Return Value

string

Exceptions

ColoristException

at line 256
protected array otherParser(string $value)

Getting the model and values from other. Format: rgb(0,0,0); hsv(15,10,3)

Parameters

string $value

Return Value

array

at line 271
protected array hexParser(string $value)

Getting the model and values from hex. Format: #000; #112233

Parameters

string $value

Return Value

array

Exceptions

ColoristException

at line 288
protected array nameParser(string $value)

Getting the model and values from name. Format: orange; red

Parameters

string $value

Return Value

array

at line 301
protected ModelInterface|null getModel(string $type)

Getting a model by type

Parameters

string $type

Return Value

ModelInterface|null

Exceptions

ColoristException

at line 325
protected syncModels(ModelInterface $source)

Synchronization of models

Parameters

ModelInterface $source Synchronization source