toColorPart :: Number

toColorPart() -> String

 

Produces a 2-digit hexadecimal representation of the number (which is therefore assumed to be in the [0..255] range). Useful for composing CSS color strings.

 

Examples

 

128.toColorPart()

// -> '70'

 

10.toColorPart()

// -> '0a'

 

'#' + [1281016].invoke('toColorPart').join('')

// -> '#800a10'

 


Prototype API 1.5.0 - prototypejs.org