@@ -65,21 +65,21 @@ div {
6565 border : 1px solid green ;
6666}
6767 </style >
68- <script src =" http://code.jquery.com/jquery-1.11 .1.min.js" ></script >
68+ <script src =" http://code.jquery.com/jquery-3.5 .1.min.js" ></script >
6969<script src =" jquery.color.min.js" ></script >
7070</head >
7171<body >
7272<button id =" go" >Simple</button >
7373<button id =" sat" >Desaturate</button >
7474<div id =" block" >Hello!</div >
7575<script >
76- jQuery ( " #go" ). click ( function (){
77- jQuery ( " #block" ).animate ({
76+ $ ( " #go" ). on ( " click " , function () {
77+ $ ( " #block" ).animate ( {
7878 backgroundColor: " #abcdef"
7979 }, 1500 );
8080});
81- jQuery ( " #sat" ). click ( function (){
82- jQuery ( " #block" ).animate ({
81+ $ ( " #sat" ). on ( " click " , function () {
82+ $ ( " #block" ).animate ( {
8383 backgroundColor: jQuery .Color ({ saturation: 0 })
8484 }, 1500 );
8585});
@@ -109,8 +109,8 @@ The `jQuery.Color()` function allows you to create and manipulate color objects
109109``` javascript
110110// Parsing String Colors:
111111jQuery .Color ( " #abcdef" );
112- jQuery .Color ( " rgb(100,200,255)" );
113- jQuery .Color ( " rgba(100,200,255,0.5)" );
112+ jQuery .Color ( " rgb(100, 200, 255)" );
113+ jQuery .Color ( " rgba(100, 200, 255, 0.5)" );
114114jQuery .Color ( " aqua" );
115115
116116// Creating Color Objects in Code:
@@ -147,14 +147,14 @@ lightness( val ) // returns a copy of the color object with the lightness set t
147147rgba () // returns a rgba "tuple" [ red, green, blue, alpha ]
148148// rgba() setters: returns a copy of the color with any defined values set to the new value
149149rgba ( red, green, blue, alpha )
150- rgba ({ red: red, green: green, blue: blue, alpha: alpha })
151- rgba ([ red, green, blue, alpha ])
150+ rgba ( { red: red, green: green, blue: blue, alpha: alpha } )
151+ rgba ( [ red, green, blue, alpha ] )
152152
153153hsla () // returns a HSL tuple [ hue, saturation, lightness, alpha ]
154154// much like the rgb setter - returns a copy with any defined values set
155155hsla ( hue, saturation, lightness, alpha )
156- hsla ({ hue: hue, saturation: saturation, lightness: lightness, alpha: alpha )
157- hsla ([ hue, saturation, lightness, alpha ])
156+ hsla ( { hue: hue, saturation: saturation, lightness: lightness, alpha: alpha } )
157+ hsla ( [ hue, saturation, lightness, alpha ] )
158158```
159159
160160### String methods
@@ -192,7 +192,7 @@ There is also a named color `"_default"` which by default is white, this is used
192192A special note about the color ` "transparent" ` - It returns ` null ` for red green and blue unless you specify colors for these values.
193193
194194``` javascript
195- jQuery .Color (" #abcdef" ).transition (" transparent" , 0.5 )
195+ jQuery .Color ( " #abcdef" ).transition ( " transparent" , 0.5 )
196196```
197197
198198Animating to or from the value ` "transparent" ` will still use "#abcdef" for red green and blue.
@@ -211,11 +211,11 @@ It is possible for you to add your own functions to the color object. For insta
211211``` javascript
212212// method taken from https://gist.github.com/960189
213213jQuery .Color .fn .contrastColor = function () {
214- var r = this ._rgba [0 ], g = this ._rgba [1 ], b = this ._rgba [2 ];
215- return (((r * 299 ) + (g * 587 ) + (b * 144 )) / 1000 ) >= 131.5 ? " black" : " white" ;
214+ var r = this ._rgba [ 0 ], g = this ._rgba [ 1 ], b = this ._rgba [ 2 ];
215+ return ( ( ( r * 299 ) + ( g * 587 ) + ( b * 144 ) ) / 1000 ) >= 131.5 ? " black" : " white" ;
216216};
217217
218218// usage examples:
219- jQuery .Color (" #bada55" ).contrastColor (); // "black"
219+ jQuery .Color ( " #bada55" ).contrastColor (); // "black"
220220element .css ( " color" , jQuery .Color ( element, " backgroundColor" ).contrastColor () );
221221```
0 commit comments