Dojo learning notes (9. dojo. Graphics. Color & dojo. Uri. Uri)
Module: dojo. Graphics. Color
The following is the color name defined in Dojo.
Dojo. Graphics. color. Named. White // white
Dojo. Graphics. color. Named. Black // black
Dojo. Graphics. color. Named. Red // red
Dojo. Graphics. color. Named. Green // green
Dojo. Graphics. color. Named. Blue // blue
Dojo. Graphics. color. Named. Navy // navy blue
Dojo. Graphics. color. Named. Gray // gray
Dojo. Graphics. color. Named. Silver // silver
Dojo. Graphics. color. Color
Color
Usage example:
VaR color = new dojo. Graphics. color. color (Dojo. Graphics. color. Named. Black); // defines a black color object.
VaR color = new dojo. Graphics. color. color (, 0); // defines a black color object.
VaR color = new dojo. Graphics. color. color (1.0, 0,); // defines a black color object.
VaR color = new dojo. Graphics. color. color ([1.0, 0,]); // defines a black color object
VaR color = new dojo. Graphics. color. color ('rgb (, 0) '); // defines a black color object.
VaR color = new dojo. Graphics. color. color ('#000000'); // defines a black color object.
Dojo. Graphics. color. color. torgb
Usage example:
Color. torgb (); // returns an array of [0, 0]
Color. torgb (true); // returns an array of [1.0, 0 ,]
Dojo. Graphics. color. color. torgba
Usage example:
Color. torgba (); // returns an array of [1.0, 0 ,]
Dojo. Graphics. color. color. tohex
Dojo. Graphics. color. color. tostring
Usage example:
Color. tohex (); // return "#000000"
Color. tostring (); // return "#000000"
Dojo. Graphics. color. color. tocss
Usage example:
Color. tocss (); // returns "RGB (, 0 )"
Dojo. Graphics. color. color. Blend
Mix another color to get a new color
Usage example:
Color. blend ('# ffff', 1); // Returns [255,255,255]
Color. blend ('# ffffff',-1); // return [0, 0]
Color. blend ('# ffffff', 0); // mix the black and white colors by the ratio of 1 to 1. the return value is [127,127,127].
Color parameters can be any color format, such as arrays and strings.
Or
Dojo. Graphics. color. blend ([0, 0], [255,255,255], 0); // will return [127,127,127]
Dojo. Graphics. color. blend ("#000000", "# ffffff", 0); // will return "# 7f7f7f"
If the first parameter is a string, the return value also returns a string.
Dojo. Graphics. color. color. blendhex
Usage example:
Dojo. Graphics. color. blendhex ("#000000", "# ffffff", 0); // will return "# 7f7f7f"
Dojo. Graphics. color. extractrgb
Convert input to RGB Array
Dojo. Graphics. color. hex2rgb
Converts an input string to an RGB array.
Dojo. Graphics. color. rgb2hex
Converts an input RGB array to a string.
Dojo. Graphics. color. color. fromarray
Usage example:
VaR color = dojo. Graphics. color. color. fromarray ([1.0, 0,]);
Module: dojo. Uri. Uri
Dojo. Uri. Uri
A class dedicated to uri (Uniform Resource Identifier) processing.
Usage example:
Uri = (new dojo. uri. uri ("http: // myserver/dojo/", "guide.html ")). tostring (); // URI will be "http: // myserver/dojo/guide.html"
Uri = (new dojo. uri. uri ("http: // myserver/dojo /",".. /guide.html ")). tostring (); // URI will be "http: // myserver/guide.html"
The URI syntax defined by RFC: [scheme:] [// authority] [path] [? Query] [# fragment]
Authority Syntax: [user-Info @] host [: Port]
For example, we define a URI
VaR uri = new dojo. Uri. Uri ("http: // User: password @ myserver: 80/dojo/", "guide.html? Page = 1 # Top ");
The URI attributes are as follows:
Authority: Server Name "User: password @ myserver: 80"
Fragment: fragment name "TOP"
HOST: Host Name "myserver"
Password: Password "password"
Path: path "/dojo/guide.html"
Port: Port 80
Query: parameter "page = 1"
Scheme: mode "HTTP"
Uri: complete address "http: // User: password @ myserver: 80/dojo/guide.html? Page = 1"
User: username "User:" seems a bit problematic, with a colon