Color.format

Tinderbox Icon


Operator Type:   Function
Operator Scope of Action:   Item
Operator Purpose:   Formatting

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 Color attribute set to a named color, to get that name string simply pass the Color 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):

Up: Item-based operators

A Tinderbox Reference File : Actions & Rules : Operators : Action Operator Scope : Item-based operators : Color.format

Quicklinks: Attributes | Action Codes | Export Codes | Designators | Date Formats | aTbRef Site Map

[Last updated: 16 May 2012, using v5.11.1]


Search:

Google search aTbRef for:  


Creative Commons Licence

aTbRef by Mark Anderson is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.

[See aTbRef CC licence Attribution & Waiver info]

Made with Tinderbox