在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:jquery/jquery-color开源软件地址:https://github.com/jquery/jquery-color开源编程语言:JavaScript 97.5%开源软件介绍:jQuery ColorSupported jQuery versions: 1.8+ Browser SupportjQuery Color 3.x supports the following browsers: Desktop:
Mobile:
Information on browser support of jQuery Color 2.x can be found in the Browser Support section in its README. Using jQuery Color in ProductionWe release jQuery Color by itself, or in a bundle. The extended names can be included as a jQuery Color plugin, or you can download the version of jQuery Color that includes the names. Choose your build from the following list: Current version: 2.1.2
How to build and test jQuery ColorFirst, get a copy of the git repo by running: git clone git://github.com/jquery/jquery-color.git Enter the directory and install the node dependencies: cd jquery-color && npm install Make sure you have grunt -version If not, run: npm install -g grunt To run tests locally, run You can also run the tests in a browser by navigating to the Animated colorsThis plugins installs a Supported properties
Example use<!DOCTYPE html>
<html>
<head>
<style>
div {
background-color: #bada55;
width: 100px;
border: 1px solid green;
}
</style>
<script src="http://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="jquery.color.min.js"></script>
</head>
<body>
<button id="go">Simple</button>
<button id="sat">Desaturate</button>
<div id="block">Hello!</div>
<script>
$( "#go" ).on( "click", function() {
$( "#block" ).animate( {
backgroundColor: "#abcdef"
}, 1500 );
});
$( "#sat" ).on( "click", function() {
$( "#block" ).animate( {
backgroundColor: jQuery.Color({ saturation: 0 })
}, 1500 );
});
</script>
</body>
</html> Supporting other propertiesThe Example use// we want to animate SVG fill and stroke properties
jQuery.Color.hook( "fill stroke" ); The jQuery.Color FactoryThe
Example uses:// Parsing String Colors:
jQuery.Color( "#abcdef" );
jQuery.Color( "rgb(100, 200, 255)" );
jQuery.Color( "rgba(100, 200, 255, 0.5)" );
jQuery.Color( "aqua" );
// Creating Color Objects in Code:
// use null or undefined for values you wish to leave out
jQuery.Color( red, green, blue, alpha );
jQuery.Color([ red, green, blue, alpha ]);
jQuery.Color({ red: red, green: green, blue: blue, alpha: alpha });
jQuery.Color({ hue: hue, saturation: saturation, lightness: lightness, alpha: alpha });
// Helper to get value from CSS
jQuery.Color( element, cssProperty ); jQuery.Color.fn / prototype / the Color Object methodsGetters / Setters:red() // returns the "red" component of the color ( Integer from 0 - 255 )
red( val ) // returns a copy of the color object with the red set to val
green() // returns the "green" component of the color from ( Integer from 0 - 255 )
green( val ) // returns a copy of the color object with the green set to val
blue() // returns the "blue" component of the color from ( Integer from 0 - 255 )
blue( val ) // returns a copy of the color object with the blue set to val
alpha() // returns the "alpha" component of the color from ( Float from 0.0 - 1.0 )
alpha( val ) // returns a copy of the color object with the alpha set to val
hue() // returns the "hue" component of the color ( Integer from 0 - 359 )
hue( val ) // returns a copy of the color object with the hue set to val
saturation() // returns the "saturation" component of the color ( Float from 0.0 - 1.0 )
saturation( val ) // returns a copy of the color object with the saturation set to val
lightness() // returns the "lightness" component of the color ( Float from 0.0 - 1.0 )
lightness( val ) // returns a copy of the color object with the lightness set to val
// all of the above values can also take strings in the format of "+=100" or "-=100"
rgba() // returns a rgba "tuple" [ red, green, blue, alpha ]
// rgba() setters: returns a copy of the color with any defined values set to the new value
rgba( red, green, blue, alpha )
rgba( { red: red, green: green, blue: blue, alpha: alpha } )
rgba( [ red, green, blue, alpha ] )
hsla() // returns a HSL tuple [ hue, saturation, lightness, alpha ]
// much like the rgb setter - returns a copy with any defined values set
hsla( hue, saturation, lightness, alpha )
hsla( { hue: hue, saturation: saturation, lightness: lightness, alpha: alpha } )
hsla( [ hue, saturation, lightness, alpha ] ) String methodstoRgbaString() // returns a css string "rgba(255, 255, 255, 0.4)"
toHslaString() // returns a css string "hsla(330, 75%, 25%, 0.4)"
toHexString( includeAlpha ) // returns a css string "#abcdef", with "includeAlpha" uses "#rrggbbaa" (alpha *= 255) The Working with other colors:transition( othercolor, distance ) // the color distance ( 0.0 - 1.0 ) of the way between this color and othercolor
blend( othercolor ) // Will apply this color on top of the other color using alpha blending
is( othercolor ) // Will determine if this color is equal to all defined properties of othercolor jQuery.Color propertiesInternals on The Color Object
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论