build/colorpicker/colorpicker-beta-debug.js
(开头部分) 52KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
/*
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.4.0
*/
/**
* Provides color conversion and validation utils
* @class YAHOO.util.Color
* @namespace YAHOO.util
*/
YAHOO.util.Color = function() {
var HCHARS="0123456789ABCDEF", lang=YAHOO.lang;
return {
/**
* Converts 0-1 to 0-255
* @method real2dec
* @param n {float} the number to convert
* @return {int} a number 0-255
*/
real2dec: function(n) {
return Math.min(255, Math.round(n*256));
},
/**
* Converts HSV (h[0-360], s[0-1]), v[0-1] to RGB [255,255,255]
* @method hsv2rgb
* @param h {int|[int, float, float]} the hue, or an
* array containing all three parameters
* @param s {float} the saturation
* @param v {float} the value/brightness
* @return {[int, int, int]} the red, green, blue values in
* decimal.
*/
hsv2rgb: function(h, s, v) {
if (lang.isArray(h)) {
return this.hsv2rgb.call(this, h[0], h[1], h[2]);
}
var r, g, b, i, f, p, q, t;
i = Math.floor((h/60)%6);
f = (h/60)-i;
p = v*(1-s);
q = v*(1-f*s);
t = v*(1-(1-f)*s);
switch(i) {
case 0: r=v; g=t; b=p; break;
case 1: r=q; g=v; b=p; break;
case 2: r=p; g=v; b=t; break;
case 3: r=p; g=q; b=v; break;
case 4: r=t; g=p; b=v; break;
case 5: r=v; g=p; b=q; break;
}
var fn=this.real2dec;
后面还有 1695 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读 AI
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
