diff --git a/color.html b/color.html deleted file mode 100644 index b81e57f..0000000 --- a/color.html +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - color_new - - - - -
- -
- -
-
-
-
- -
-
-
-
- -
- -
-
- -
-
-
-
-
- -
-
-
-
-
-
-
-
-
- -
- - - - - - - - - - - - - - - - diff --git a/colorPicker.js b/colorPicker.js index c50d536..693c29d 100644 --- a/colorPicker.js +++ b/colorPicker.js @@ -68,11 +68,13 @@ CSSPrefix: 'cp-', scale: 1, allMixDetails: true, - alphaBG: 'w' + alphaBG: 'w', + imagePath: '', // noAlpha: true, // customBG: '#808080' // size: 0, // cmyOnly: false, + // initStyle: 'display: none', // memoryColors: [{r: 100, g: 200, b: 10}]// , a: 0.5 @@ -88,7 +90,7 @@ // noRGBg: false, // noRGBb: false, - // CSSStrength: 'div.', + // ------ CSSStrength: 'div.', // XYZMatrix: XYZMatrix, // XYZReference: {}, // grey: grey, @@ -305,9 +307,10 @@ _data._cssFunc = _data._cssFunc. replace(/§/g, prefix). - replace('_patches.png', !_isIE ? urlData + _data._patchesPng : '_patches.png'). - replace('_vertical.png', !_isIE ? urlData + _data._verticalPng : '_vertical.png'). - replace('_horizontal.png', !_isIE ? urlData + _data._horizontalPng : '_horizontal.png'); + replace('_patches.png', !_isIE ? urlData + _data._patchesPng : _options.imagePath + '_patches.png'). + replace('_vertical.png', !_isIE ? urlData + _data._verticalPng : _options.imagePath + '_vertical.png'). + replace('_horizontal.png', !_isIE ? urlData + _data._horizontalPng : + _options.imagePath + '_horizontal.png'); if (!style.styleSheet) { style.appendChild(document.createTextNode(_data._cssFunc)); } @@ -322,9 +325,9 @@ style.setAttribute('type', 'text/css'); _data._cssMain = _data._cssMain. replace(/§/g, prefix). - replace('_bgs.png', !_isIE ? urlData + _data._bgsPng : '_bgs.png'). - replace('_icons.png', !_isIE ? urlData + _data._iconsPng : '_icons.png'). - replace('_blank.png', !_isIE ? urlData + _data._blankPng : '_blank.cur'). + replace('_bgs.png', !_isIE ? urlData + _data._bgsPng : _options.imagePath + '_bgs.png'). + replace('_icons.png', !_isIE ? urlData + _data._iconsPng : _options.imagePath + '_icons.png'). + replace('_blank.png', !_isIE ? urlData + _data._blankPng : _options.imagePath + '_blank.cur'). replace('"Courier New",', !_isIE ? '' : '"Courier New",'); // style.appendChild(document.createTextNode(_data._cssFunc)); if (!style.styleSheet) { @@ -340,6 +343,8 @@ } } + app.children[0].style.cssText = _options.initStyle || ''; + return (_options.appenTo || document.body).appendChild(app.children[0]); } diff --git a/color.js b/colors.js similarity index 100% rename from color.js rename to colors.js diff --git a/colorPicker.css b/developer/colorPicker.css similarity index 100% rename from colorPicker.css rename to developer/colorPicker.css diff --git a/colorPicker.dev.js b/developer/colorPicker.dev.js similarity index 100% rename from colorPicker.dev.js rename to developer/colorPicker.dev.js diff --git a/colorPicker.html b/developer/colorPicker.html similarity index 97% rename from colorPicker.html rename to developer/colorPicker.html index be6d5d2..f613ad4 100644 --- a/colorPicker.html +++ b/developer/colorPicker.html @@ -181,8 +181,8 @@ - - + + + + diff --git a/developer/patches.html b/developer/patches.html new file mode 100644 index 0000000..f116147 --- /dev/null +++ b/developer/patches.html @@ -0,0 +1,20 @@ + + + + + +patches + + + + + + + + + + diff --git a/developer/patches.js b/developer/patches.js new file mode 100644 index 0000000..c369530 --- /dev/null +++ b/developer/patches.js @@ -0,0 +1,43 @@ +;(function(window, undefined){ + "use strict" + + var shades = document.getElementById('shades'), + ctx = shades.getContext('2d'), + myImage, + counter = 1, + scale = 1, + dim = 256 / scale, + DIM = 255, + imageData = ctx.createImageData(dim * counter, dim), + data = imageData.data, + x = 0, y = 0, count = 0, z = 0; + + shades.width = dim * counter; + shades.height = dim; + + for (x = 0; x < dim; x += 1) { + for (y = 0; y < dim; y += 1) { + count = (x * dim * 4 * counter) + (y * 4); + z = 0; + + + // data[z + count++] = DIM - x * scale; + // data[z + count++] = DIM - x * scale; + // data[z + count++] = DIM - x * scale; + // data[z + count++] = Math.abs(DIM - x * 2 * scale); + + data[z + count++] = 128; // 127 ??? + data[z + count++] = 128; + data[z + count++] = 128; + data[z + count++] = Math.abs(DIM - y * scale); + + z += DIM * 4; + } + } + + ctx.putImageData(imageData, 0, 0); + + myImage = shades.toDataURL("image/png"); + console.log(myImage.length) + document.getElementById("MyPix").src = myImage; +})(window); \ No newline at end of file diff --git a/_bgs.png b/images/_bgs.png similarity index 100% rename from _bgs.png rename to images/_bgs.png diff --git a/_blank.cur b/images/_blank.cur similarity index 100% rename from _blank.cur rename to images/_blank.cur diff --git a/_blank.png b/images/_blank.png similarity index 100% rename from _blank.png rename to images/_blank.png diff --git a/images/_horizontal.png b/images/_horizontal.png new file mode 100644 index 0000000..aaa6bd0 Binary files /dev/null and b/images/_horizontal.png differ diff --git a/_icons.png b/images/_icons.png similarity index 100% rename from _icons.png rename to images/_icons.png diff --git a/images/_patches.png b/images/_patches.png new file mode 100644 index 0000000..7eeb9e9 Binary files /dev/null and b/images/_patches.png differ diff --git a/images/_vertical.png b/images/_vertical.png new file mode 100644 index 0000000..4870bc2 Binary files /dev/null and b/images/_vertical.png differ diff --git a/index.html b/index.html index fb11e87..f702811 100644 --- a/index.html +++ b/index.html @@ -2,8 +2,8 @@ - - + + colorPicker_new @@ -57,8 +57,8 @@ - - + + diff --git a/index.js b/index.js index b2f90df..6378096 100644 --- a/index.js +++ b/index.js @@ -446,6 +446,7 @@ isColorPicker = colorSourceSelector.value === 'ColorPicker'; myColor = window.myColor = color_Colors; + // color_ColorPicker.nodes.colorPicker.style.cssText = ''; // mySecondColor = window.mySecondColor = new ColorPicker({instanceName: 'mySecondColor'}); // in case ColorPicker is not there... @@ -468,7 +469,9 @@ } - function conversionTest () { + function conversionTest (skipDisplay) { + if (skipDisplay) console.time('convertAll'); + // conversion test var convert = myColor.color ? myColor.color.convertColor : myColor.convertColor, x = 0.85, y = 0.33, z = 0.23, k = 0.1, @@ -506,20 +509,22 @@ // do nothing } else { value = convert(color, fromMode + '2' + toMode); - colorOut = []; - for (var s in color) { - colorOut.push(s + ': ' + color[s]); - } - colorOut = fromMode === 'HEX' ? '"' + color + '"' : '{' + colorOut.join(', ') + '}'; - - valueOut = []; - for (var s in value) { - valueOut.push(s + ': ' + value[s]); + if (!skipDisplay) { + colorOut = []; + for (var s in color) { + colorOut.push(s + ': ' + color[s]); + } + colorOut = fromMode === 'HEX' ? '"' + color + '"' : '{' + colorOut.join(', ') + '}'; + + valueOut = []; + for (var s in value) { + valueOut.push(s + ': ' + value[s]); + } + valueOut = toMode === 'HEX' ? '"' + value + '"' : '{' + valueOut.join(', ') + '}'; + + console.log('convertColor(' + colorOut + ', "' + fromMode + + '2' + toMode + '") = ' + valueOut); } - valueOut = toMode === 'HEX' ? '"' + value + '"' : '{' + valueOut.join(', ') + '}'; - - console.log('convertColor(' + colorOut + ', "' + fromMode + - '2' + toMode + '") = ' + valueOut); counter++; } } @@ -528,6 +533,8 @@ } } console.log('Tested ' + counter + ' conversion combinations (excluding same to same)'); + if (!skipDisplay) console.log('Call conversionTest(true) for timer (incl. calculations in for loops though...)'); + if (skipDisplay) console.timeEnd('convertAll'); } window.conversionTest = conversionTest;