| Package | vegas.colors |
| Class | public class HTMLColor |
| Inheritance | HTMLColor RGBA RGB Object |
| Subclasses | SVGColor |
Read the about it the W3C HTML 4 Specifications (chap 6.5)
Example :
import vegas.colors.HTMLColor ;
var n:Number = HTMLColor.htmlToNumber( "#FF0000" ) ;
trace("convert #FF0000 : " + n) ;
var c:HTMLColor = HTMLColor.YELLOW ;
trace("c.toString() : " + c.toString() ) ;
trace("c.toString(true) : " + c.toString(true) ) ;
trace("c.valueOf() : " + c.valueOf() ) ;
var htmlCode:String = HTMLColor.hexToHtml( 0xFF0000 ) ;
trace("convert 0xFF0000 : " + htmlCode) ;
// output:
// convert #FF0000 : 16711680
// c.toString() : Yellow
// c.toString(true) : [RGBA r:255 g:255 b:0 a:0 hex:0x00FFFF00]
// c.valueOf() : 16776960
// convert 0xFF0000 : #FF0000
| Property | Defined By | ||
|---|---|---|---|
![]() | a : Number
The alpha component (between 0 and 1)
| RGBA | |
![]() | b : uint
The blue component, between 0 and 255. | RGB | |
![]() | g : uint
The green component, between 0 and 255. | RGB | |
![]() | luminance : Number
Indicates the luminance of the color. | RGB | |
| name : String
The name of the color. | HTMLColor | ||
![]() | offset : Number
Defines the alpha component value with an offset representation (between 0 and 255)
| RGBA | |
![]() | percent : Number
Defines the alpha component value with a percent representation (between 0 and 100)
| RGBA | |
![]() | r : uint
The red component, between 0 and 255. | RGB | |
| value : Number
The value of the color. | HTMLColor | ||
| Method | Defined By | ||
|---|---|---|---|
HTMLColor(value:Number = 0, name:String = null)
Creates a new HTMLColor instance. | HTMLColor | ||
![]() | clone():* [override]
Creates and returns a shallow copy of the object. | RGBA | |
![]() | difference():void [override]
Transforms the red, green and blue components of the color in this difference color representation. | RGBA | |
![]() | equals(o:*):Boolean [override]
Compares the specified object with this object for equality. | RGBA | |
![]() | fromNumber(value:Number):void [override]
Sets the red, green and blue component with the specified number value. | RGBA | |
![]() | fromNumber(value:Number):RGBA [static]
Returns the RGBA representation of the color number passed in argument. | RGBA | |
hexToHtml(hex:Number):String [static]
Converts the number passed in argument (the html color in hex with ECMAScript notation 0xrrggbb) in a HTML string representation. | HTMLColor | ||
htmlToNumber(sHTML:String):Number [static]
Converts the string passed in argument (the html color) in a number representation. | HTMLColor | ||
![]() | [override]
Interpolate the color and returns a new RGB object. | RGBA | |
![]() | interpolateToNumber(to:RGB, level:Number = 1):Number
Interpolate the color and returns the number rgb value. | RGB | |
![]() | set(... args):void [override]
Sets all foor components of a color. | RGBA | |
![]() | toHexString(prefix:String = 0x):String [override]
Returns the full hexadecimal String representation of the color. | RGBA | |
![]() | toNumber(r:uint = 0, g:uint = 0, b:uint = 0, a:Number = 1):uint [static]
Converts the red, green, blue, alpha values in a decimal number color value (base 10). | RGBA | |
![]() | toObject():Object [override]
Returns the Object representation of the instance. | RGBA | |
![]() | toSource(indent:int = 0):String [override]
Returns the source code string representation of the object. | RGBA | |
toString():String [override]
Returns the string representation of this instance. | HTMLColor | ||
![]() | valueOf():uint [override]
Returns the real value of the object. | RGBA | |
| Constant | Defined By | ||
|---|---|---|---|
| AQUA : HTMLColor [static]
The html 'aqua' color static reference. | HTMLColor | ||
| BLACK : HTMLColor [static]
The html 'black' color static reference. | HTMLColor | ||
| BLUE : HTMLColor [static]
The html 'blue' color static reference. | HTMLColor | ||
| FUCHSIA : HTMLColor [static]
The html 'fuchsia' color static reference. | HTMLColor | ||
| GRAY : HTMLColor [static]
The html 'gray' color static reference. | HTMLColor | ||
| GREEN : HTMLColor [static]
The html 'green' color static reference. | HTMLColor | ||
| LIME : HTMLColor [static]
The html 'lime' color static reference. | HTMLColor | ||
| MAROON : HTMLColor [static]
The html 'maroon' color static reference. | HTMLColor | ||
| NAVY : HTMLColor [static]
The html 'navy' color static reference. | HTMLColor | ||
| OLIVE : HTMLColor [static]
The html 'olive' color static reference. | HTMLColor | ||
| PURPLE : HTMLColor [static]
The html 'purple' color static reference. | HTMLColor | ||
| RED : HTMLColor [static]
The html 'red' color static reference. | HTMLColor | ||
| SILVER : HTMLColor [static]
The html 'silver' color static reference. | HTMLColor | ||
| TEAL : HTMLColor [static]
The html 'teal' color static reference. | HTMLColor | ||
| WHITE : HTMLColor [static]
The html 'white' color static reference. | HTMLColor | ||
| YELLOW : HTMLColor [static]
The html 'yellow' color static reference. | HTMLColor | ||
| name | property |
public var name:StringThe name of the color.
| value | property |
public var value:NumberThe value of the color.
| HTMLColor | () | Constructor |
public function HTMLColor(value:Number = 0, name:String = null)Creates a new HTMLColor instance.
Parametersvalue:Number (default = 0) — the decimal color number value.
| |
name:String (default = null) — the name of the color.
|
| hexToHtml | () | method |
public static function hexToHtml(hex:Number):StringConverts the number passed in argument (the html color in hex with ECMAScript notation 0xrrggbb) in a HTML string representation.
Parameters
hex:Number |
String |
| htmlToNumber | () | method |
public static function htmlToNumber(sHTML:String):NumberConverts the string passed in argument (the html color) in a number representation.
Parameters
sHTML:String |
Number |
| toString | () | method |
override public function toString():StringReturns the string representation of this instance.
var c:HTMLColor = HTMLColor.YELLOW ;
trace( c.toString() + " : " + c.toString(true) ) ;
ReturnsString — the string representation of this instance
|
| AQUA | Constant |
public static const AQUA:HTMLColorThe html 'aqua' color static reference.
| BLACK | Constant |
public static const BLACK:HTMLColorThe html 'black' color static reference.
| BLUE | Constant |
public static const BLUE:HTMLColorThe html 'blue' color static reference.
| FUCHSIA | Constant |
public static const FUCHSIA:HTMLColorThe html 'fuchsia' color static reference.
| GRAY | Constant |
public static const GRAY:HTMLColorThe html 'gray' color static reference.
| GREEN | Constant |
public static const GREEN:HTMLColorThe html 'green' color static reference.
| LIME | Constant |
public static const LIME:HTMLColorThe html 'lime' color static reference.
| MAROON | Constant |
public static const MAROON:HTMLColorThe html 'maroon' color static reference.
| NAVY | Constant |
public static const NAVY:HTMLColorThe html 'navy' color static reference.
| OLIVE | Constant |
public static const OLIVE:HTMLColorThe html 'olive' color static reference.
| PURPLE | Constant |
public static const PURPLE:HTMLColorThe html 'purple' color static reference.
| RED | Constant |
public static const RED:HTMLColorThe html 'red' color static reference.
| SILVER | Constant |
public static const SILVER:HTMLColorThe html 'silver' color static reference.
| TEAL | Constant |
public static const TEAL:HTMLColorThe html 'teal' color static reference.
| WHITE | Constant |
public static const WHITE:HTMLColorThe html 'white' color static reference.
| YELLOW | Constant |
public static const YELLOW:HTMLColorThe html 'yellow' color static reference.