X-Git-Url: https://scm.cri.ensmp.fr/git/PlinnDocument.git/blobdiff_plain/57a4d385a1d2806d5877f53b1fdb0bd94efa2dbb:/skins/color_utils.js..3b91dbcbb0b99d3d796a01813018db0e540bd0ec:/Products/PlinnDocument/skins/static/gitweb.css?ds=sidebyside diff --git a/skins/color_utils.js b/skins/color_utils.js deleted file mode 100644 index 7c70d07..0000000 --- a/skins/color_utils.js +++ /dev/null @@ -1,117 +0,0 @@ -// (c) Benoît PIN 2006-2007 -// http://plinn.org -// Licence GPL - -function HSVColor(h, s, v) { - this.h = h; // 0-360° - this.s = s; // 0-100% - this.v = v; // 0-100% -} - -HSVColor.prototype.toRGBString = function() { - var rgb = this.toRGB(); - return "rgb(" + String(rgb[0]) + ", " + String(rgb[1]) + ", " + String(rgb[2]) + ")"; -}; - -HSVColor.prototype.toRGB = function () { - var h = this.h; var s = this.s/100.0; - var v = this.v/100.0; - if( s == 0 ) // achromatic (grey) - r = g = b = v; - - h = h/60; // sector 0 to 5 - var i = Math.floor( h ); - var f = h - i; // factorial part of h - var p = v * ( 1 - s ); - var q = v * ( 1 - s * f ); - var t = v * ( 1 - s * ( 1 - f ) ); - 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; - default: // case 5: - r = v; - g = p; - b = q; - break; - } - - r = Math.round(r*255); - g = Math.round(g*255); - b = Math.round(b*255); - return [r, g, b]; -}; - - -function ColorIterator(baseH, baseS, baseV, step) { - this.baseColor = new HSVColor(baseH, baseS, baseV); - this.currentH = baseH; - this.step = step; -} - -ColorIterator.prototype.next = function() { - var c = new HSVColor(this.currentH, this.baseColor.s, this.baseColor.v); - this.currentH += this.step; - - if (this.currentH >= 360) - this.currentH -= 360; - - return c; -}; - -function setBorderColor(ob, colorString) { - var s = ob.style; - s.borderBottomColor = colorString; - s.borderLeftColor = colorString; - s.borderRightColor = colorString; - s.borderTopColor = colorString; -} - - -function setBorderStyle(ob, borderStyle) { - var s= ob.style; - s.borderBottomStyle = borderStyle; - s.borderLeftStyle = borderStyle; - s.borderRightStyle = borderStyle; - s.borderTopStyle = borderStyle; -} - - -function setBorderWidth(ob, borderWidth) { - var s= ob.style; - s.borderBottomWidth = borderWidth; - s.borderLeftWidth = borderWidth; - s.borderRightWidth = borderWidth; - s.borderTopWidth = borderWidth; -} - -function zfill(number, digits) { - number = Math.floor(number); - var nStr = String(number); - while (nStr.length < digits) - nStr = "0" + nStr; - return nStr; -} -