代码如下:
/**
* @file
* ,----, ,-.----.
* .' .`| ,---, ,----.. ,--, \ / \ ,-.
* .' .' ; .' .' `\ / / \ ,--.'| | : \ ,--, ,--/ /|
* ,---, ' .',---.' \ | : : ,---. | | : ,---. __ ,-. | | .\ :,--.'| ,--. :/ | __ ,-.
* | : ./ | | .`\ | . | ;. / ' ,'\ : : ' ' ,'\ ,' ,'/ /| . : |: || |, : : ' / ,' ,'/ /|
* ; | .' / : : | ' | . ; /--` / / || ' | / / |' | |' | | | \ :`--'_ ,---. | ' / ,---. ' | |' |
* `---' / ; | ' ' ; : ; | ; . ; ,. :' | | . ; ,. :| | ,' | : . /,' ,'| / \ ' | : / \ | | ,'
* / ; / ' | ; . | | : | ' | |: :| | : ' | |: :' : / ; | |`-' ' | | / / ' | | \ / / |' : /
* ; / /--, | | : | ' . | '___' | .; :' : |__' | .; :| | ' | | ; | | : . ' / ' : |. \ . ' / || | '
* / / / .`| ' : | / ; ' ; : .'| : || | '.'| : |; : | : ' | ' : |__ ' ; :__ | | ' \ \' ; /|; : |
* ./__; : | | '` ,/ ' | '/ :\ \ / ; : ;\ \ / | , ; : : : | | '.'|' | '.'|' : |--' ' | / || , ;
* | : .' ; : .' | : / `----' | , / `----' ---' | | : ; : ;| : :; |,' | : | ---'
* ; | .' | ,.' \ \ .' ---`-' `---'.| | , / \ \ / '--' \ \ /
* `---' '---' `---` `---` ---`-' `----' `----'
* @version 0.0.2
* @author 赵大牛
* @license MIT
* @description 创建一个颜色盘窗口,选取颜色
* @global $.global['#ColorPicker']
* @returns hsb: number[], rgb: number[], hex: number[] } | null}
* @requires zd-es-lib {@link https://github.com/zHaOdANiuu/zd-es-lib}
* @example alert ( app.objectToJSON( $.global['#ColorPicker']() ) )
*/
(function() {
function __spreadArray(to, from, pack) {
if (pack || arguments.length === 2) {
for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) {
ar = Array.prototype.slice.call(from, 0, i);
}
ar[i] = from[i];
}
}
}
return to.concat(ar || Array.prototype.slice.call(from));
}
function mouseMoveEnviron(element, callback) {
var leftClickStatus = false;
element.addEventListener("mousedown", function() {
leftClickStatus = true;
});
element.addEventListener("mousemove", function(e) {
leftClickStatus && callback.call(e.target, e);
});
element.addEventListener("mouseup", function() {
leftClickStatus = false;
});
element.addEventListener("mouseout", function() {
leftClickStatus = false;
});
}
function mouseMoveElement(element, callback) {
mouseMoveEnviron(element, function(e) {
this.location.x += e.clientX - this.size[0] / 2;
this.location.y += e.clientY - this.size[1] / 2;
callback.call(this, e);
});
}
var undef = void 0;
var random = function(min, max) {
return Math.floor(generateRandomNumber() * (max - min) + min);
};
var clamp = function(min, value, max) {
return Math.min(Math.max(value, min), max);
};
var Color = {
rgbNormalize: function(rgb) {
return [ rgb[0] / 255, rgb[1] / 255, rgb[2] / 255 ];
},
hsbNormalize: function(hsb) {
return [ hsb[0] / 360, hsb[1] / 100, hsb[2] / 100 ];
},
randomHexColor: function() {
return this.rgbToHex([ random(0, 255), random(0, 255), random(0, 255) ]);
},
rgbToHex: function(rgb) {
return "#" + ((rgb[0] << 16) + (rgb[1] << 8) + rgb[2]).toString(16);
},
hexToRgb: function(hex) {
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
return result ? [ parseInt(result[1], 16), parseInt(result[2], 16), parseInt(result[3], 16) ] : null;
},
rgbToHsb: function(rgb) {
var _a = this.rgbNormalize(rgb), r = _a[0], g = _a[1], b = _a[2];
var max = Math.max(r, g, b);
var min = Math.min(r, g, b);
var delta = max - min;
var h = max;
if (delta === 0) {
h = 0;
} else if (max === r) {
h = (g - b) / delta % 6;
} else if (max === g) {
h = (b - r) / delta + 2;
} else {
h = (r - g) / delta + 4;
}
return [ Math.round(h * 60), Math.round(delta === 0 ? 0 : delta / max * 100), Math.round(max * 100) ];
},
hsbToRgb: function(hsb) {
var _a = this.hsbNormalize(hsb), h = _a[0], s = _a[1], b = _a[2];
var r, g, _b;
if (s === 0) {
r = g = _b = b;
} else {
var i = Math.floor(h * 6);
var f = h * 6 - i;
var p = b * (1 - s);
var q = b * (1 - s * f);
var t = b * (1 - s * (1 - f));
switch (i % 6) {
case 0:
r = b, g = t, _b = p;
break;
case 1:
r = q, g = b, _b = p;
break;
case 2:
r = p, g = b, _b = t;
break;
case 3:
r = p, g = q, _b = b;
break;
case 4:
r = t, g = p, _b = b;
break;
case 5:
r = b, g = p, _b = q;
break;
}
}
return [ Math.round(r * 255), Math.round(g * 255), Math.round(_b * 255) ];
},
rgbGradient: function(t, rgbStart, rgbEnd) {
var result = [];
var i = -1;
var len = 3;
while (++i < len) {
result.push(rgbStart[i] + t * (rgbEnd[i] - rgbStart[i]));
}
return result;
}
};
$.global['#ColorPicker'] = function (config) {
var ColorPicker = {
name: "ZD Color Picker",
author: "赵大牛",
verison: "0.0.1",
units: [ "H", "S", "B", "R", "G", "B" ],
dataFontSize: 14,
picker: {
rgbSize: 20,
hueSize: 10,
strokeWidth: 2
},
srcImage: "PNG\r\n\n\0\0\0\rIHDR\0\0\0ÿ\0\0\0ÿ\b\0\0\0>\b\0Ê\0\0\0\tpHYs\0\0\0\0\0\0\0O%ÄÖ\0\0\0$zTXtCreator\0\0\bsLÉOJUpL+I-RpMKKM.)\0AzÎjzÅ\0\0 \0IDATxík¯ÛÆ®`ÿÿ߸¿Z$M&Îãq)ÝXXÒ\fùrlë!GòJûá8þýù÷çßØÏþýílþé×À×Ñ´|å8?Çë|ÇAß¿§ã8诿þ¢¿þú¾}ûFþù'ýöÛoôÓO?Ñ¿ðÿ{ñ¯~ýù\vZÐ8ÏGóàç^ë·÷óýû÷ÓÏýÛ·oôõëWúòå\výþûïôñãGúùçé¿ÿýïÿP_þ¼ø3/þ¬u4³±\rx/>0;ÿ Í£óc\vt\vxýêô\vüO>ѯ¿þJ?ýôÓÛÀúå]6ø¾}]¶å&\n.~X¤køú#ílG¶Æ+Ú8>PÀéqý[Ð/Ðèe·_àÿñÇôùógúôéýòË/ôÓO?ÑÏ?ÿ|+üä/ººUÊ9òú£Ú¥¦ó:~àÎ}0ÆͱàaW¶î±CXQXóã¿þúËmõW×ÿüù3}üø~ùåúõ×_éãÇ[á°¿ràõU@¾N¿¼ÖÊn*ó_¨ lèØæk±@&å¶ÙªË±Ì^ñîÎÎ=}àÐËmþú½À_]ÁÿÛo¿ÑÇéÓ§OôéÓ'úý÷ßÇáÿ }»Íy\r\b,á:7¾GY;²±ÙâèÛp»ÍÇP§»·6Ù¢[>|MÞ6~ýÖÀçÚ²µÿþýû±'¢¼ãKðåÁÿùógúüù3ýþûïôåËøo^Y¯8Þþ¶Í VÀ¿»8\0o*ñKí\b`WXNnßù.ÿAÎu¡×àÛücOBðõë×Ó½¾ýüñÇôåËúúõkþéV4m&]z`U\v^¶1©m;R<=\rV/ÆÊíÞιٹÙñå6\0Þíêìøàã¼ ð'Á÷ø}[~ÿ~ýüùçôíÛ·2ü«ÚÀÎWíFÛ¡Ñb¬~xçå@\n1æ³ÕÎÁ®~(c§<Eð.XÅ Óí£{l»|ýúè_þ,ð«ðw{ç¢Ý/Õ9|ÑöÛí®«-ü`ÙªðVAÓ\n|-ÙnÎý0Æ/Ûy~l@oýzz<¼«ÏáçÛý¯_¿DôaÁ/ÖÎ`Åfá_¹@vÂÃÒtbªúÈÙo{T,Õ\tk÷èðDNaE³ÐÝ/вã°[¿Ù±Ôw¿÷~nÿ,ô(Õ®¯<è»\0>¿b¾ÿ\f|ýð°[[N|_ÛëÙuÅ\"\v´5§]¤ÌRS±lWçÊÙ͵1ðîùʯí\føùw÷Ç÷ïßDàÐ[~³\0ð1þÒLuþ.ûè»q®ìXõÀzW,é¤Àïnß30˱àØÈùúMqÿêö^-\bô~v~¬¯ñÐ-¿Öù×\n?\v«ëBÝ\"dº0[jE×üÖ!Ò\n4Ü%'¥®Ã)\0ÑöÝ\\ÇÆ.(>Ïâbeî1÷\v\nÀ©XÇ-øÙï<wÈ_vöuß³ûsèù\t!ðw·û¥o\fH*À«;ä%9Ýê¾<¿ftov4¿ª¡ÅÀósﵨPóc¾e^½×Æxgç××Ùc¨È±Ý¿ÜÓs«\b¿Þ;í<øµðíÛ7úòåËA\"\"»þqXço°.\nôÙ-3=ÅKþ,9ÊËyhÄâ½|Ñëà¾|Z§µâÂpÙ¶óãsصÃ+à_~ÿ]\vNsðå¬`^\b\0ðe·_ù?XÐ÷úO=øå¶~ÚõwÃ\0zs,C^ÀèîB®Ë;sÓ\nZ²pkÚ|Í\n¼î×p<iTvx9/\nÁãG-üâ÷åÁÞãP÷ú ÏçÖ9]ÀGá¯nù+àW oÿðCó¥o4ð¢´VV ¬â §ù,HX¸(xq<&*\n\vL-Î+<Bàü\v^lóÕ§ûøëxý%ÜÂËb ®?×^ë\f;}üèn)cn!´4âÌÍ-Za05cìø0ÆÍKT?ujÇñ\\èVÿ`sp!à[{\0þË=äë=¹ð?Dt)2;à¯ú+0¢ÐÃÀ/\v\\#¼pu¹1?R´ÂÀµô-À¥¿«|-(Üc¹!êò\t0\nó]þh\0þg ѯø úY9èÒõ#ø³[þ?ô\r\0½ðSýeq¸RðRmûîå\bpµ0dBä¯ÁªÈÜ, ØÏ0h`K\t²òsh¾Ú÷øã§?òO~ÇïtþË-ý:þã?)?Óõ³à£Ý>}fÞó{Ú\tàÃuHp5_^«0Br¾eÌ»ÈvûCúZ
@h«Û}é(îwùÊïK\bò?¡Öà÷J-ùdR
ÿ)å?¦×!/¾ÀÜ÷©íirV5 ¾æW¦µ«Û\\ÓÀr]1ç°RÓ+ZÑ0\0ÔáÙØÉ×)\0§=ðßíêÚC@Y(´âBtf:ÿøü¡üУ]ÛÝ9Äóuý¡¢ÀáÕÖEïä\0éøn1óÜ\nÐÏÜì<ìð·ÅWÀúYOùåV}uõè\0þU^´³Xï\t²íG·ñh×Ïoú\vÖnù°)SÖü/eõ¬\"}Q?±65±Ô\nY?eÌ,^A0ù^¸ç§ød\nÁÉOî\0ì9@{Àgýø}Ùh»~ÿoÇó+?þ~còéö«À=æÐÎmJdm]I?ÓçZÔ®¬~³ÝðQ;¹×üB˯Múh
ÀóSÜÜO{ØxÐw*\0Îù¨~ÒèúU¶>ùtàGº>ä#/teèW|§
Þ˧¸ßð
>Ò/XóJ?u }Égù\bÍ¢|ùñצÀýãPòyéGàVPºý©÷úæ_ó1Íïù{ÖNßûkùÖ±¼>Z\b|¤Û{ .\"U8r¯ïÞLùõºE#\tºY4´|PM'û(ó®W\b?ÕÇ+ÆVÿéÝç
OúOpkÛ÷èÕýåkïY~è^¿£º\r° ·&µâ«ø¬\vÕÊèDyZ¡Z\f8|rä\r`-NeN
\\þ|Oóüj0\nAX\0,¸µ½ü\noåáÝ_®ÃÏßÓrço2øâ\" 7ÖAy g#ÚögæOy\fá-[\bU\r^,d¡°\n)\0s\rr«\b0pN[EÏ+[onóÓ'Óýµm½µõô®62¯Åuûè\0íâQ|\b¬#Ó½+Ý=zÈÅsyMßðQçУn¯Æ#{ó¢sºûø}*Ê}¾ûz\0ÚtÇó?ài¼¾çàc½Wjç÷ÙÇ|¼ùJa`¼èB¯h«ñZQÒr;E%=ï\f¤XÚÙùÔöß×â-ÐY¼õU^rkÞºßsÖ}¾¹\rX¯#Úþ[;\x009¯¼¿O+Á_ït{\rg¬L¬AoèÐJy±æpO*sÚÚ¼bg>ÛõO XSë[E@Æjó5e gñÖ=ôe mó½êþ²8÷èôïã0ø5àöâKà¯ymÒ*\npµ¼ZA1 ×ò¢Ûþ°k¯%´\\S¡`×æ2 [sÚ¼Ù+ä¼\0\0÷ú.Ä^°\0vÇq<üIèe íüU¸£9ußÝ\tX99$¦µ$j6¦B-Ee!AæB!Ã/ÀÊØ\tØ×rMȸhNW\r8 E¾¿\n1;îóOB\0})k¾Ûý×ïémi®R$ LÇ»áõ4%ØÙb!5\r½òU(\0Øe8t¿0ÎÜÚX4Ð
ÞéÁ§l÷/s¼\0h·Zók}äDöw÷<N¬S¾§niø+ æ\"ð[;\t\r)Éèµ8JÀ«¬O÷2gÀiBÍeby¸-ÆM0Wí)¿^\vft¦i}µîdìäbNÕsRou>&\v_Îeàï÷-½¹À\0V×ÀÁqQÇáUÖϱ<§)+FWH¢Û|¸\0ãáQ<Ø!е9ðqç~ßvé%·ùêä_Î)ï\r~߯ñ4Ñù=ÀÇcPY¼ußo¬\rÊ\"Åd\v
R$Ô9$&Wàtw7&¾-&S¢\rô5'Aç1²H¼\0p-\rfí|SÂéäÞÃ=ÃMOmû3Oî¬?Hº°¹.#)1{v\v`¹Þ°û[1P>.ÃRÝØ´gË¥¦%cñ\\ûc«´¼®ÝhÝç^1¼\0ð9«û÷(×I~k¼<;.H0ÄrÑQü!-{A\"uq©
íîþ¥@ÈÜ$@dSn÷fãa9´qù\0Ï÷õ.èÚè>ßzXçí2ãÚð®ès][Ƽڸd¯¥7ÒÖiÉâa ¹\b2éóõHHd\\êH}×ò7ÆO Ô¸õPûk\0yØ'ǵÛ\tïÁº-ày?ç¶þHéü:ûþ\\s|¬ $À»7ÓÎú9ÙE¯Ëqõö@@eÇâ{¯ï4.:Þ¸§!A·ÆåC<oÜyÌÎ@hÝÚ½fë¯Í-Ûå^_ê´Á',ÓrwJ¾Ó \nlÑ÷Sh¸P*ãp'ý'ùæ¸2Áþô Î÷û w\f|ÜÚ]·ùV±ÝkÈ1>nYþ1-\rÐ×ö4Æ.0dmLí©!K÷,\rk\\÷,yW}%¬ëX§ùÊqbæ×t1\vöPÃòãDØ/¾Öv_émõµz¤^÷G5ã|K MÆrá·ÆÅÜ®Ðr»\0¯SOûF_ÓX7}5]>Æ.ª.ð;6\v\t\x002i`ñ:J°sßL·×Æ{}ë©}¦£K_ö^|I¿uÀomµ-9nm³]ß`ÌZ×Ä.@ËÈøs+`hñJ˸3ÁYñ<w}ézñjã¬.Àr,òE¾âã`ÅKP
_ªûóëhý¬~ìZ:ù¶;f\\\\¼&äxWÚD<_ôÂ×-¦¯Á)b!1·8©`Zãѽ¾6¦B,5°µ±¦v_¾ äñZaÐ4}J[*\n1iÖx~´CgÖÆÒyä¶n9¶.2ÉüÜtÚº%4Þ[Y¹58×';&.nB>&ã%ØÒÏêö(Þwþ2yj¯Ýh[Þå¥æ2y¾¥ócîv[Ób1±\vÈ6Ì\"o\vp+ÖÓôX>
v~è¾Óô<`ùúøX¶c{chQà±²\0h~Ú¾²ÍƸÉs¢&üß4øè\0
ÎáÅR¢X~V즱pûùI½ì¦ÇóFctç2¦V;«WeïÿjkL[óSðïØòóóv1ºr¬ü »K_ÒÊ1-hÌÒÒÖÆÁ~?»!±ã]óúF'6·S`ïËÚhL~ÇǸï2yÎǹAð1÷ë<g¬ÓáSZüµÆs\"\fèhñµ1ï~>,»à.úr]l ´õG|4hµ±uîÝ(Úݺ߱ÞÃ>´Ók÷ùËäÿ\tÃí8â¯úÒ_ó±\vÄØ#|+äSa¯§³¥ãD>\rLÄçƼýÁ.5ÔbÔw}¸²ÌÇä È1ë!ß:wÂ%Îvvjqvµ¯ûU:¿KÎ/z/bùçÏ1W**V÷n*©íÑß\râsYbÅkq\v$î£Åq¸x.@Oû8ì,Ç*÷üw)\b\bìV§ÇQÜ2-^ÎÍÀUAw}jqx^!cç¤Äb¸«èsNY3îÝ
¸[(´sklÁÄsY>üüFí«»\vÜ2½ë£÷Ñüä<Q~ä~?\rºrúHýjç¯éµ¢KÐP!ºO~®ù0la8m¿](Vaçj¡Ðr\vè.ÅDPÆ|À-øÅÑaïA97?gëI)\bòû~϶w~Â:z1âãæa«>ò\\\0½·1ÜÇÝiHм<®ªÄtsc,\\º\nþߺuXï]'&7±|´sMW³.üÈÃ8ixè|Ak±QLúþË×âè\"dÅyPÈ31¯ê¬Ìößq»¾c\v0&úº®ª}SPÙÚ£ßñóKå'ç¸iãc_^ØC:øt\nº¨8W5Cå¢uXâ¢>X<)>ª¦¥!ÖåÎ{>¦q®ëÆ(9/`
Oüåy^M£\0oæL÷_¿e÷G.ÎKð#>Æx¥Gù²Å¢²# TÅDsÍäÖ,\rO8'R1ÖÀùàüÜûªÏû/ÒôÎ×ÛàG÷úÜü\\39/ýøy\b¿«êñ\v`wÏób¢B`B)bÔó!´Ú§ÎÙ
¦Â³ÖZçç<'påôü(Ô«\böÙØàÇ<F#vç?òº2[D´ÅÏvy8_æ<Ï{?Ö9ªÿ·{\\(<ÿ(Þ÷ü'ε|f^9oøg^çëÚðæ®Ãëþü|é{óDtùwÊ?ôYç§Î¾ÖscÚ8»é¼]³pe[ßögÇ)¨×I&¾rnåsâ[]ÿçX¶n÷çã|Þò·b½yÏFà·:~#]Ý9÷òo)F|÷^>,^¬kê|éÍZ£È\\6¯k¹v³× ·ìöZqaóéXþöÌÒ\"ÚéAq>V¨Ðå¹OpyCëR$Ĺ¥.\n?Ë+!wcµyM\v<¿hg´2Oä#@Ñíþ:_~Þ¹ÔÒ´¹EÚMmûewÌ\r¨y#¸ÕXo,î''§Á6AV|/çÜ?\vÏ<kB®Cñ½ÄJX-¯5ÎO±{~\"½ëZsѺI-m]^^ë÷:÷ùñXniøù\tøiçpg|Õç+×lÍy\bÕ|³±ëkÃ͹`z±ÊyÆ÷ð=½^ôûÌÍb!öYÆ}ù¥¹t¢s+Ïù2?WáÏøy[~¸ë¬³âëI9Öæ:ÜôÐh±Î\\è«Äz Êó¾gÄ×S»¶5çmá£ûyÄy9¹v.×ç\n¿¥ÍÀîåv9ª
´[àsʱ|§ø/²
÷Øié¡?ÍIÀ¤nÆ\vºº9·ÌóîÉ3÷þÚ®BÓáã!·ÿè°Ój!¨Î]|×1æPù\0¬°\bù%ÌÐ̱ÎùÚ¤±n_ÎÜÕósѾ5îÍñüĽ¦/?cÞÎ@3é3²íw|J»\0ÊÁÊÆA»~ljjqæè*¼RcÅq?@æqìsJ\0¢\vä^ÜÊtêSkÇ)kQó3m-Ò¬1-fÓð¿öð^Ýó4ùægÞߣq¦¦aÎs¢ÏuI?vn®Kãú\\]³·ü¾ÿ¯º©ðÐ8[_ëÉc#óðÅÃÅ]{D¤oç¥j¯ú<P¡ó@£\n;÷\rç\f?|ÔokúÂ\fͨ\b ñôåº,ð¤&2'5,x#}q\\íì¨Y\0V¬±ç\\¤¯ibÞm×àçÜÿfa\v¿<Gýø
iépXèØÞ³ü\f=8±öêÎàãg/ã¡TõSô.s|\\óSryÐC~lQå\"ÂtÌb ]/Þ_äy»\r+ºg~Ú:¤?bËÏ_ݾ£~J\n]E_øÑ]/è\vШ_pljTô\0?L\btCd\0,ý¼¼\\k\0â¿õÞOù)×\\øç¹kÜÛ]h~RCêZ·Ü×òKu~y.ÆÓ
ÈîúBÛ½µÐüµv\v¼}§¿O¦º½ªÍ.hÔÞ¶Ëuc0ÔÃ`¯ßÞ2ÏÏëÜÖ·EÀ¯óÌW~ÚëYÖßð©lù+ÅÃ-$<qr°ócE#U¸£Í\tRáà5wZÎ\x002µ °R ²ô%¾æ»-¹¦-MËÝë/C¾·×â¼9~d+\t\n¨ÇùÀSÏx¸XTâ-èÁ)æ¬ø\nÜV×Rt¡â<u|?8>Ås«tnòßíóµjÇr,*»:¿5êô\t§kä¨tl®Ú%(Çîo[pr-\"èë;¨88pZkqCê\"ÐZ@\b³ô³¾\nD»??öþ%!㿽cÔ²Oû-àÜE\x009ûvjO9ör+y ]ëuc\"\\~ä`>n·ç>§«G>®¥
¥þeR\0 ®ç±Ã*iù´sÞáÝfé¯ú\fÊ6ýrù³ã¨µ*Ç]B© h cD×ò1Æâ`Cú¬X¹>ç¸\fzq}ÏÏr¯ßÎýwêØzXÇó[ë°¥qÈ~·)ø1wk®ùxþèZãhÝc\r2ë¸ wõh\\®ÃZæãÄÂ
=ö4;ÇÊup6:ÖbùkvÞ1rß_µQø§ýØNÿãhýÙؼpA°F!Òǯé<ÖIü÷2>kfiZ1Î?¿°Ci\0ihëng×sü¿¥4;>N¬\vý§¿·#¹âÄ]õtÖï¿?ªY±U=¢&ü«C±éu%_ZÀØñ-¿Ìo¥â#ó¿êÈÞzk×BõZcÈ7cbÆsEë³ü'à·`äÍkÙÑÝSyäq&g yCzѸ\vwÔµÏ{ëÚrßO¾Õ³÷È,(âúJ[ôÐ/cUø/Ðh1hOhi)Ç[m»5º½§ëÅfÂéÉqEÛºÀU\r%¿\vàÊiåÇ2ÏèV~ìs\fÁõôäµe]wÈWpùk°,ó'¿Ë2ð»]]SæMȼX¹º±£kkr{Ü?·ô\r\v5NY\t²Oi$KqD×\vßƵkæ8ìm¸µÐ4,ógÍyCÀcZá§%WôxçE'áËÆEÙ-{5o{ÍyG\\;¨5\r\v6\v^/³yäÝ2çÓq±wÌ>ÿ˱·|d>Ë¢ÚxÆ¢ÿ\t<stnÇ}':}\nfJtn~Ì.<oþä+ MÅiù¤ôõâß°\0Ç®.Y\f¢âtéîÞë@·tµ8yvsyîý}ê¿äã%!RëÂÑó`CºßÊV¿¼ý·|\rH.ZbÞÔ\r|]¨«¾<ÿ|-_m;î&Àõ4GëâË×£N¾j-ø)±3|I¿°¬5D·»§1_ñM\tíõÐ|ópºrÌ:¶ ãÇë}çñÀ~õõÏÑ
^úʼåË-*Z^m.2~M$Sæ·B,ô¡\\\rîV;7
áq>»ªï¬»\\,¤¯Ô\":ÁåùùñÏ_üuº<öæŵvñk}g\0¢¶44ø¡ûn)·ÞXdOù'!Oé÷j¼ËõK\0TÀ´\\~6^BÌg:¼\n8ûÌÔxoÞ|,*\nès\0mÞÒ×æÕÉ`þ8ôç\rÜäý¹ó'çË@Gó\n0ZÌ\bä&8ïi¢Ë«Å@×\0]1DtçcÈü2ï°Y¬/3¯]ÓVNë5i>°â¿)ø#¸·íh¦\0£GW0£ù0Æ#rÀÔòD1È<×'p· ^Gvà\rïþ(W4ÖgËÇPè£m~gëÏÏgþ[¶óSÜÍ+Àwb2·0ä\\ÇʳbÑ-5æåñtØ¥\0\nózPq\r@E¿ßÑX´¶eÑ6Û{ }-;Ð;ÂvvmLñW¡ÓÆC%Ú=tt4øNz[#º\0yÉíéÚÇ¢P'¼-Ðbøÿp§ïPñ`s0ô6±zV§ó´ßDó´£\\¨kvu[ÑvwÝ1e0|Úë\v´5¿4¤±çû§Áùcmûý£9F¿\ràc\\Û²ÏóþÇË×úª/ãÀA3ÝüÖb¡1½[Ǭõñ×)Ç4èÑ\t0X®mÅVÆÐûvcìùáuÆ*÷þݱþ[«Úø½-ðÙX\r@ØÂWÆ´µ\b .cZ,°£~»ÆxÞèO|×çÅõ¡åªÐ÷ÌCCÖÄu¬Úü!4¾¡«Ím^ø£÷\vt§¶ÿD±¦Xr\n
5¦}M·>+\r:5}×\0\0AIDAT0OÇ&ºðÅ/ÈOÒ´1dN[51~qa þÚ\\§W»´ö&v¥¢áA¦Eºä\07©¡uÑðÀÖ4,PÙçKÃÖ{íà\\Ã1ÒÖµÌý~s,©§
B}üKÀ\v\rª4ÈÊ\\w¥»»9A@M}Ãß*6©ýzmüsÐæ´®¿,Øþ 7´Ü1Ë#÷5¢ÉÍû=t)Ë/²Ä\\X2ú¿5ùëImÝÅÑNkÎ=ÆMȹEõ·æ:þÞ°Ã(H! a\"éïÍEú\bàüugÿÞßÒÿcò⦠£7ÁõæªEãÀK-wëÎAÓÆ<ÿÌý½6äÁ\\Ú½êÇ?àmÌ¡!=×Bý½5{V¹ÿ¯ÂݺïÓºÌi ÒMÀ£q¦JyN¼Ö2äH6Ç_,mvokzy4F!i¨Õ9Ï´5íñÜ\t´\vK\\ÅG½q<^èÍiù9$¸XayÜôH-0 |5ÉéRÇæH¸¶·X~ªyµ`eÞÖÀÓ|4mmMZ^¡*&@Ü\t6//«'òaõæØûuåîñ¸R!à¯ÓÒí)Þ38)ß³Gs6öþþ£ïj>Þþ_õvàE¼õ%ëxsCÁm¬-]\fmë¾:ço|V$^¼÷'íÚ9´xo ¬CºµvÇ?HÚö#]~âL\vTo¢3\rµ¦ä\bw4ÔùüÑíR¤ïWäÃu<,X\\¦Ï%Ç-ó\nR&õÄ_{íÝó'|·\nÄG¬#sÐûF¹<G¯ä#.x\\J\tNàúð7h!]_ñ\ruÄ{új>Þz¤¯è\\ævXùÚáèd|¡Z.º^\\^ÎLq^ñuwÒ·ëC ÜDWÐ:¾üM±äiPZ>/²Åör.]©'>wÕWË)}´9kªX¨ñ?í\b|h3¾@myE*\t_øHÒUÞÔ\fÜÏü¾â3 ×t3°§ë«ÌÌkº$|+µ\nüÓÝ=³_t{ ãé®sk½¯±~¨{Ë5X`²5¡º§nø^ô£XúûMÙ\t Oûµ×(?SKiúIU5_DWÑ¿ÌY¾¡ãÃvuþÎN ³ú¥ñ\ròdÃhpÖ\bùRf~ág|åë^Ïå}Îæá¯\v¹ç_&}3[þÊçd\nDÕ:ÿ¯¾Ðw÷N·WcÖ9'tÆC¬îÚX¶fÈWüNíH\\¬<Xç|¬ ±ÉXáëvH,²Fnÿ£ÎÌÖþ\0m»È+ð®ìæ5 Ð×y6ÖÑ;¾Wb\t\b¤\vµ¶ä/üägiÈMËɯæÕÎ+·\0Ò¶ý{þÂ9´@¦¡]/DËíàë<xÐn@[¯%\v-ÓªtüSÇkªËEþdnGS5ôNY`µ\\Ñ-j£ÿníbÛ¡É~»Á^C©i[뫾üv«xßOÝ,¼üÕª<1w4JPqíj¡ðü¤vEC³ðºyR32¨uÑÎ\0üÞ,Þ<ºîè7°`jkæÁÁli[°\b&TÍÌ×QeN¶¶f#ðãÔ¯àÖùðZÒ\0#k\tÆ[ GóÖëìøMÒ²èC½\b0ëóàkr¡äÁ;·rUòUÖ$Ìä¹yÁÊs>^µ¼®J\\°æ1°«q(ÚïíRÁ\0°æ½ñh-hÏ殥ÁÒ>+89n`ÝoúíÖ!Ь÷
CW-\fÕytÂݵª®Sá¿\vöjÞ®ßT|0¿uÛ_ñÛUîú~ÒªóèxF4~wñXðÄîóÝq¯¿k¾ë?ßý]ØÞ§âÐ.:ÆÑyï÷³ó¯ßËî:7¿h£@Gýªþïö[¾ÁÁûòëGù#Ëæ°Ûá¿!î]º½ù¢×È_K£\rv5nܬewS÷ørYkö:¯ZGçá7/Py.ÆÇ»½³Y ¼?w\r¼ÓªvA7Öâ-5´lñè©5köJø#¨'·ðÝ®^)fÓ
ÜY ±É.èò=èj\"9£÷_Z÷\0CùÔóé?êÚð@E±¨å¹«¢øÖíüÊøäÚº÷ È.Àºù´vÕ¬yH¬õ:<ÛÿxW4ÓP3C/ú·¥í|KÑÞÕé'µäïßRG\0 Ï\0´X´Hì\0·ú\"@j>»¬¥Ä@lh;À7,ØÑN/Þ£±¢i\"0ZZ·ûË2
ų\tøÍmn\"6Óm±ÆÅ<±¥/mÙu ±B@\rÅZZ5l^Tù\f \rñ¾\f;²\t بÀh±hQ\"jÀOÅ®LÅ[\"D¾TǶb½(ö®B c31ÀJ\fUcÙ{[±¬Óí½<(ÈHZíÿOþJ}
\"½\vÈÄÁZ
(S\bÂ<2ÖÑuc5M}6[@bî[)$ÅÀujZþÌ÷é_\bÜï\0ä®. B§½¶WÁYK|\tR$@]Bb<_¯\vG1äXÆwÙ._¢¡Îï@è!»Â\0Àî¯sO_Ý|õj>Å{0êË>D¯í+ÞËMnÏÇó\rÖúÀðSÒ]A2gª£ËÜ^ò\v¬¥ëè¤v\v5¶CVoÈÑQ}I±Ì½~¥s¡µNm]gø3÷ø% e@örd xjGàvwù:=\0 ʵk>\bÌ4IC@äÌÃFÏgÒFà§&äRê:,e.U\b´xáëåºûc-£ÅaÚG¼ïéÂA!OÓ3>Ú\\3_£\v2Å(³Èøíy*~'ÐZ~då5·\n^~-ÃEÌïhÃpù·ññÁ·p®/}Äç¢æÐâû~ÏÇ[bQ|«ófJ{ h¸Ûfo\nAy' ÍÉ59qi¸åÚ¼xt.s/ÏßDoÜʧò\"kÚ<N«X÷v²ü`aº¹¿uÎ[K±H Ûvuîâ&á¾k.¼w»@U«vòn04Ýùðw;ö@³s£yë\vÊl÷µ5¤wHqx¬c;Àüðæº;Äu,,«nû½.õOÍñ±\"áÍe¡´ª@ÆdÅ?*\0¬jÇ¿~ðµZ©Pì\0Þ#Å´9ôÁ¼Ô² {ë²ÌÀ'ý£»ìmÀÖB ù]ACýµ9¡C¾Áß¹ëÏ?\0ä6(æ\\aëò÷,\vºåïÁïîò
8È\tmõ\rÔ°³KÍÏ[c¤\vÌÓ
ÜÑ(ìùûõ¶ôçcÕBuþÆ´¥à§<ÌV@xgªuø\tP5Ýìî@óËéf!סßÝ'ÆNüMï\0ïéfwÙÝAdâ
¢[«ch®$à#^óë\fjÛ}4vènwlYÌHwxt\f5ehÉØüª¿2?éXì_º`ìMmì6 ;cÆ7\0[@º³§}ðåó±Ý\tÿí{±?6¿\vÄv¬7¦½Çk})äѽ}v~SÀgýÐØ»ÿ®¨?õ Lv¥d»o¸®©â\\WÒ,m´CGð.«
æÞ+4|5´Hÿ|ÄØË\0¶ÖÓÐQa®®C¹.]1aÒ(\rkóäÄ,Ó@\0ïùEóÓý2ë!êuþÊÎ`ª8tïߧ·újî(¦Ç,$Ú<9Eáâj̲.äÀÚ.15¿¬|î© \r?;jv÷hÞ¾+¨©ÆXóÌÔ\x007³òDÊ|;({Ì/Co¢>?U8xËÍ|Õñ)ø£J÷îÎWºm\b¸Ãç\r]M«\x004rVÀìΧ!EÌÄxÅÄÒîå/pFðUvN~Ëeü!¨ï>Ï/VÅ·h»hhk²æ30R½s¿l^ñÌCÌ&ã»@ï.\bx¢ÁÎoT'\rÒ¼8vç3ZM¨y\\ê~¼\x000¤%>àw
Ò²¶àh.bVyvð8&iÕ£Y4¿ó+ÀüWݺOÞ&¤v\nh!ýµWo\vJÅä»å»rZ#0ó±I°ùÌv^ø´|5s^ïÅ7ÒªúJëÂ2³uç¦p·øjÅÆ\n\0ûP3¾íb0\t»7îKÌ¢Â}'\nFwoålj7àÂO¹ÎÞ[«ºÖEä\váÌä`ãNàÓ^w#ìÕ8×7ó²`<ÆÉó Î+.c^\b~BçrIÀ泫qÆ:2 st\\êµN+ѸvEº-Ç˲ÅC³jÜÃßÕ@LÓØa0üwå¬F\bô0¤Õmúékdâã)\nÔü5TÖ!':w¦\bT\vÉcü¢7QµV\r-ø«Ûzn\b(g§XT\vGµ°cyu§].Sp:9Ç´Ç$-\v0Q&OV;ÊÃR4ªðsËܳ·s¢£§ó\f\0~ì]
Í9\tøhÎNG_ÖÑëÀ\\µÌklþV7Ï]cv½;îÄf¡Äx½;\0/SÆ2þÈÚ³>¶~ȧ(\r]±ÁTÞp½à#¹&vïd[áßTPÞèNì;±ÿ¿ûÝÿAÔvwþô
ø´ó½¸æãuL2ý~ØwÙÔZ_öç½r¼\0Îݯs+\0±ÝÅàߺXX·æ¼£[Ôa(ô.\n)ø©\0Î&ïîæÛÁC{¤ó|n;_RÎ'ý: JÛUDH|]«=¢<üÝN~\vÌ,G©k<]\v\0gI«[@µ[²õïÀîÙ¤¢»ÛBø©\0©éçI{`nÇ{1À±§=\rúîmz%&n%¾h¶pxÖíôÅ8?½¥'2Ëo4FMÍnnÄ»1\0h.¨.ܨßH÷'ªmãQ?Ë^3eðÃõs Eü*1Ý\0º2,׸ö\rpoÑÛã\nÄAQ\bý<m´ë[y<ÛýOz+Ìós\nM¥ÃÀµ¶w»õºÅAúm*\b¨_TtÛêí,$§ý%?ªQ³óq;As5Fe¯«ÒSsÇºÊ s¡ßÆø¨(ìèÜDÁxÙ÷*sh/í}èA`FCÂË4§\v«ñXçVèA÷æÆ4ªsð«°k{´`T-[$*ðOtñ±¸háÓ©lÅÃ9®Û\blëõì^Wa.¼uâªÜÐÅ¡sY_\nn9nCçcEóò=ÖþÃkønÕ¶ZôV#×µ6üäCì]à2*_¾¶N¤YÙ-´t;Aoëd¶ìð'´ê\\ƺ:üäÃ7qY'Ðú2Ý*ä_ËzßPg @d|=ÐLßà{ÅE kúzVÝ!T|Qø3\\Zu»íêdu©XHÄy\b.˳ 8±mßÇúÓ`OòU_y¾Ù×4Z¦ìÒ¶ütðN¬ô%»k§!fZàåy*ÏcÓwb§:¶ê{Cliûõ Ìì¢Ømùoø- *Êy'¶z;gÀ¹¶Bîh¥cÙy;¶¨Ýô\0ÍÏ2y#»åô.\vàïl»[Ý?y«ýX{¥ ZÑùdÁpÎ; CZÅ\\eÐ\\¥Ýv±I-ËvÁéu #\n ͦ;\vBáüÎ\\[Aîæ9Æßú®vçö`ÊLø§A7>©·µ¸Ü|®ÀÖ÷Jè³çcpÜ}~÷oÚ4~þ÷Ñ5 Ù|DoyÎ^ÓdwÞ¹ÞÛA7ýl¼åÏá»îOoXÖRù¹sÁnYÃ;6¶û|ë¦ÁçÃÝðgá,d,\\#9
f÷ücPÞXH\\ÍiÐÛ¡YµQø\ty@#,4P\0º;w\tuBSc\fr6V.$\t\r\tyK2[\\4;Öötê\0ä)iL\r¹³£«Wbvl·+1£Ý<'¥QÌãI´v\n]ø+°ÅgdGðÛ<g%fKHêN@itóTføH\fb»dá¯téR÷×|&\n«Ôñùï*\nÚ
»èQ]ÔÇè Nê)iwéV}w~c¬ÒËpW|VÊÈçEEAkùùßX:¦Óµ±·õÑÆ´N¼\vâ;¾%hÃOØPA@´±)¢â®è6wj· gcÏNívw×ƪàOɸe.üZíôP÷µ¦ 5ãĺÊù5\n-® õj ݸ¤y:N³jª
·à¯nÏ«ZcZc»¢êZUSZý6ÐZèÒÝ3cÒ44'bÙ¸\nüA\0¡úHÁAsc-këæ¼æ¶~a,\rªßéîÅ\0µ]úSðßÑýwÎ\tXónà;c»a¾c¬ÔU_56Ùõ+v7üDÿC¨½Qaã?ÌÖÅïÛ½|¢:ü\b·Æz:àlËC Æѱ»ò¤ÇÒ]¼çÈ3ÖÉÙXçOÆ·\n
O`xè¾U±hhòüe#_èÖ¥<f§Á7o×BøÉR³L|·(X¾L®» NÇ7|·Æ¾wñ½×¿»µïh×Àéþ]ÐñiÃÎ éÛ
poîQ_6Þ|Ü׬[d,ënøµ.;úÖbAJxälÁ®g|'4Æï[öÖ(ûZãð-{eAhuþLQ } [ã8·ìøÕÈOh°ñL·¾hdÁßY,>#Û¿iAÏ»àQbw`o*$Ùñ\tXñ\t\0³ã·æ|¢ ì°ÿ?ã9à(Ñýßqúëß\tÞ?zÍmðUàß¹N\tÿ«º?Ñ=@uXÂwã¹ß±Ð¹-ãZÁ×^î¾ã/Û\t¶{zsS Oj
ÒÀíÃS\bqR+\vפñàf1ÙñI-ü»E~òaNÇò@7b&»wCFqHæ)\b/&¡·\r`ºFç®ÄÏ*1Ý¿á§\"°¤wO¯²3põkÛ9s\"ÙAÜõ´\\\f®íéMvîTLu®ªg¿Úýß¡\0¸¹ÒÐzs^K«tko®ïö\\àÜÜÞ\\UoôÿÒËÎÕ9ÏeØwSæï÷-æØüø={×Æà§ùî¿â,xÂØê³5g̿лtGæÄüm6çÆsNýÇ=SðÍ®âÆn\0¹ëÁÓBÙ
u±Up;±i@wÁÍwàÎì2²ð·C0ß*\0µmÙ]8ó»@æwÁÍÅ&çGcóã±Ñ|~îȦáoªh¾yw¾zw¾l4ß²;ß³;_sÞ®]à§`#óßï\b1_ßËA7|Þj^ñ¹}^ø¼å<Q¿ëgç5øÛÝúh`@´ò\t.è»aÐè7¡±µÛß¹Ý_V\0x'4\0hðôi\0\fk4}î\0ñ¹æFÁ'i«Ñ¾ÿçFþ»à}Ö²\"Í\0ßé3úÅÇð{ïôiAO4þ®OÔÁmv^îwW¾qÈ¿;!¾;ßV
_hDïÏwä«üEõ.DÀnÍø!@mÓrü¦\0Eý¶kýÞ\nè_ÕTøiØWù¥Á¥û\nêWêÔ?â;\tòÞõcc@ßágÁ?Ýý`?t'v%MÀ7]0MÔ¯¬éøNlúe| ~ß涿¬\r?áPïòÝQ¾¿üîw/\nå.ßv!Ê/´wøB0ïòÕl~¢à±IX³¾;µË
¾àø·}.Pº¾þïÚo>?å Íúg ÞíK!\0cvúgÀÍúg:õ¨¿3\n¼ðϹÛßò÷àÏv¢½¨X1N\\ñoç\0bvBnú;1pCÿJÌ@-³mþMÃO´èVL2®U<À¸ n7än7£Äeá
cDÜ1c]ø)r'î. «q.c+pWãî¼W·W·¸\n¾Á_íþDÂñÈ[*
Ø;¡îÆ v\väNlôNìvàEì(ÀÛ\t?Q½\0ÕÀ3¶_-Ød|l3¯ÆñÛA7â«Ð¦cE|\tÞ]àðS`¢ÄÏøFæK|A£µÐèÀÆÈáxG£{:^Ñè@_gf<?Q¿\0õÀS£©Ó-¢NjW#¡Ó
Ò\0tº¦5\f.¬e\r¡ÓêöÈ
¿»ýç6Q:˦ACkæi\t°!Poð£7{YGÑÛ²Å×\ffºÿIh¤\bôMí04o)\fEÍ)°Ózæ-=CsÒУÏ\t2ðÍ\0¢¼«;¨=\tq¨ÙÐ:м¬èOÃ9®Ë´!Í,üD{\nÀSì,rLÜ´9¦¶Ï#ÚÓw¾cËÖ>>Q\r~Z\t6Seòíèæ©<9wÜÊSÈ·¾-y|[ïã«·UøíܨùäÀæü;¶äíÃù§Tݯ|ùKùºðO|s!¸ävÓzîµ_Ú«´WÍîÞ9D6õÌ`~n¯.Ò^ѹ#»c˱;¶½»¦WïPÛñp~nwܯOØ]÷Éön ZöXî~~±Óîxn°~i»¶ßiw=ºÃ^zñ¿â¡ê;Ùß6Xv'üíúNúG±ÿ%ø*öÃÙο´w?c?ʶ÷G²ÿ9ø2ö¿tÛµ>|ø§_üÿhû·øýsíÿ\0âI1Kʱ\0\0\0\0IEND®B`",
barImage: "PNG\r\n\n\0\0\0\rIHDR\0\0\0\0\0\0ÿ\b\0\0\0wÁa\0\0\0\tpHYs\0\0\0\0\0\0\0O%ÄÖ\0\0\0$zTXtCreator\0\0\bsLÉOJUpL+I-RpMKKM.)\0AzÎjzÅ\0\0\0IDAThíØË\r@\fQý×Ë/Ôà@\bÍÞ|¬[³WÒú=°<¾\0\0\0\0\0À/[W¶°É)È\0\0\0\0\0×gu4e Â6Q
þÈ\0\0\0\0\01`i:t'%\0\0\0\0\0ø(°º2à¬Ta¨Â?\0\0\0\0\0\0ÀGXî=Æ\f\0\0\0\0\0÷;<Ùo´\"ÙtbiA\0\0\0\0IEND®B`"
};
if (config) {
if (config.dataFontSize) ColorPicker.dataFontSize = config.dataFontSize;
if (config.picker) ColorPicker.picker = config.picker;
}
var marker = false;
var pickerSetting = ColorPicker.picker;
var window = new Window("dialog", ColorPicker.name, undef, {
closeButton: false
});
var leftGroup = window.add("group");
var colorBg = leftGroup.add("group");
var colorSrcImage = leftGroup.add("image");
var rgbPicker = leftGroup.add("customview");
var rightGroup = window.add("group");
var colorBarGroup = rightGroup.add("group");
var colorBarImage = colorBarGroup.add("image");
var huePicker = colorBarGroup.add("customboundedvalue");
var colorDataView = rightGroup.add("group");
var sample = colorDataView.add("group");
var colorDataGroup = colorDataView.add("group");
var hexColorDataGroup = colorDataView.add("group");
var hexTitle = hexColorDataGroup.add("statictext");
var hexTextBox = hexColorDataGroup.add("edittext");
window.margins = 5;
window.spacing = 10;
window.size = [ 640, 400 ];
colorBarGroup.spacing = hexColorDataGroup.spacing = 0;
window.orientation = "row";
leftGroup.orientation = "stack";
colorDataView.orientation = colorDataGroup.orientation = "column";
colorDataView.alignChildren = [ "left", "fill" ];
huePicker.size = [ pickerSetting.hueSize, pickerSetting.hueSize ];
rgbPicker.size = [ pickerSetting.rgbSize, pickerSetting.rgbSize ];
hexTextBox.size = [ 64, 16 ];
colorBarGroup.minimumSize = [ 25, 265 ];
colorBg.preferredSize = [ 255, 249.9 ];
sample.preferredSize = [ 54, 32 ];
sample.graphics.backgroundColor = sample.graphics.newBrush(0, [ 0, 0, 0 ]);
colorBg.graphics.backgroundColor = colorBg.graphics.newBrush(0, [ 1, 0, 0 ]);
colorSrcImage.image = ScriptUI.newImage(ColorPicker.srcImage);
colorBarImage.image = ScriptUI.newImage(ColorPicker.barImage);
hexTitle.text = "#";
hexTextBox.text = "000000";
hexTextBox.active = true;
huePicker.value = 0;
colorDataView.add("button", undef, "ok", {
name: "ok"
}).onClick = function() {
marker = true;
window.close();
};
colorDataView.add("button", undef, "cancel", {
name: "cancel"
});
var length = ColorPicker.units.length;
for (var i = -1; ++i < length; ) {
var g = colorDataGroup.add("group");
g.spacing = 0;
g.add("statictext", [ 0, 0, ColorPicker.dataFontSize, ColorPicker.dataFontSize ], ColorPicker.units[i] + ":").onDraw = function() {
this.graphics.drawString(this.text, this.graphics.newPen(0, [ 1, 1, 1 ], 1), 0, -ColorPicker.dataFontSize + 1, ScriptUI.newFont(this.graphics.font.name, "", ColorPicker.dataFontSize));
};
g.add("edittext", [ 0, 0, 2 * ColorPicker.dataFontSize, ColorPicker.dataFontSize ], "0");
}
var rgbPickerBrushColor = [ 1, 1, 1 ];
var rgbSize = -pickerSetting.rgbSize / 2;
var offset = colorBg.preferredSize[0] + rgbSize;
rgbPicker.onDraw = function() {
var pos = pickerSetting.strokeWidth / 2 + 1;
this.graphics.ellipsePath(pos, pos, pickerSetting.rgbSize - pos, pickerSetting.rgbSize - pos);
this.graphics.strokePath(this.graphics.newPen(0, rgbPickerBrushColor, pickerSetting.strokeWidth));
};
huePicker.onDraw = function() {
this.graphics.moveTo(8, 0);
this.graphics.lineTo(1, 5);
this.graphics.lineTo(8, 10);
this.graphics.strokePath(this.graphics.newPen(0, [ 1, 1, 1 ], pickerSetting.strokeWidth));
};
var changColorData = function() {
var hsb = [ huePicker.value, Math.min(Math.round(100 * rgbPicker.location.x / 255), 100), Math.min(Math.round(100 - 100 * rgbPicker.location.y / offset), 100) ];
var rgb = Color.hsbToRgb(hsb);
var colorData = __spreadArray([ 0, hsb[1], hsb[2] ], rgb, true);
for (var i = 0; ++i < length; ) {
colorDataGroup.children[i].children[1].text = colorData[i].toString();
}
hexTextBox.text = Color.rgbToHex(rgb).substring(1);
sample.graphics.backgroundColor = sample.graphics.newBrush(0, Color.rgbNormalize(rgb));
if (hsb[2] > 90) {
rgbPickerBrushColor = [ 0, 0, 0 ];
} else {
rgbPickerBrushColor = [ 1, 1, 1 ];
}
};
var changHueColor = function(e) {
huePicker.location.y = clamp(0, e.clientY + huePicker.size[1] / 2, 255);
huePicker.value = Math.round(360 - 360 * huePicker.location.y / 255);
var value = Color.hsbToRgb([ huePicker.value, 100, 100 ]);
colorBg.graphics.backgroundColor = sample.graphics.backgroundColor = colorBg.graphics.newBrush(0, Color.rgbNormalize(value));
colorDataGroup.children[0].children[1].text = huePicker.value.toString();
hexTextBox.text = Color.rgbToHex(value).substring(1);
};
mouseMoveElement(rgbPicker, changColorData);
mouseMoveEnviron(colorBarImage, changHueColor);
colorBarImage.addEventListener("click", function(e) {
changHueColor(e);
});
colorSrcImage.addEventListener("click", function(e) {
rgbPicker.location = [ e.clientX - rgbPicker.size[0] / 2, e.clientY - rgbPicker.size[1] / 2 ];
changColorData();
});
window.layout.layout(true);
window.layout.resize();
colorBg.location.y = 0.1;
rgbPicker.location = [ rgbSize, offset ];
huePicker.location.y = 255;
colorBarImage.location.y = 5;
window.center();
window.show();
return marker ? {
hsb: [ +colorDataGroup.children[0].children[1].text, +colorDataGroup.children[1].children[1].text, +colorDataGroup.children[2].children[1].text ],
rgb: [ +colorDataGroup.children[3].children[1].text, +colorDataGroup.children[4].children[1].text, +colorDataGroup.children[5].children[1].text ],
hex: '#' + hexTextBox.text
} : null;
}
}());