This version is out of date, covering development from v5.0.0 to v5.12.2. It is maintained here only for inbound reference links from elsewhere.

Jump to the current version of aTbRef.

Tinderbox Icon

Color.format


Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Operator First Added: 

Operator Altered: 

 Function   [other Function type actions]

 Item   [operators of similar scope]

 Formatting   [other Formatting operators]

 5.8.0

 


Color.format

New to v5.8.0, returns Color as a hex-string, regardless of source data is a hex value or named color.

Thus if $MyColor is "bright red":

$MyString = $MyColor.format() gives "#ff0000"

$MyString = $MyColor gives "bright red"

Whilst if $MyColor is "#330099":

$MyColor.format() gives "#330099"

$MyString = $MyColor gives "#330099"

Therefore for a Color-type attribute set to a named colour, to get that name string simply pass the attribute's value to a string. So if $MyColor is "bright blue", this:

$MyString = $MyColor 

…gives "bright blue" and this:

$MyString = $MyColor + " ("+$MyColor.format()+")"

…gives "bright blue (#0000ff)".

This supplements the existing format() function.


Possible relevant notes (via "Similar Notes" feature):


A Tinderbox Reference File : Actions & Rules : Operators : Action Operator Types : Formatting operators : Color.format