mirror of
https://github.com/PitPik/tinyColorPicker
synced 2025-07-18 15:34:29 -06:00
Merge d3d9c6e4d5783b0682c59c9f68fee4cabad5654b into c0847d644df00c18fd9e5524737658ac93e2810d
This commit is contained in:
commit
1b4100c2fc
20
colors.js
20
colors.js
@ -1,4 +1,12 @@
|
|||||||
;(function(window, undefined){
|
(function (factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define([], function () {
|
||||||
|
return factory(window);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
window.Colors = factory(window);
|
||||||
|
}
|
||||||
|
}(function(window, undefined){
|
||||||
"use strict"
|
"use strict"
|
||||||
|
|
||||||
var _valueRanges = {
|
var _valueRanges = {
|
||||||
@ -15,7 +23,7 @@
|
|||||||
grey = {r: 0.298954, g: 0.586434, b: 0.114612}, // CIE-XYZ 1931
|
grey = {r: 0.298954, g: 0.586434, b: 0.114612}, // CIE-XYZ 1931
|
||||||
luminance = {r: 0.2126, g: 0.7152, b: 0.0722}, // W3C 2.0
|
luminance = {r: 0.2126, g: 0.7152, b: 0.0722}, // W3C 2.0
|
||||||
|
|
||||||
Colors = window.Colors = function(options) {
|
Colors = function(options) {
|
||||||
this.colors = {RND: {}};
|
this.colors = {RND: {}};
|
||||||
this.options = {
|
this.options = {
|
||||||
color: 'rgba(204, 82, 37, 0.8)', // init value(s)...
|
color: 'rgba(204, 82, 37, 0.8)', // init value(s)...
|
||||||
@ -39,7 +47,7 @@
|
|||||||
}
|
}
|
||||||
customBG = _options.customBG;
|
customBG = _options.customBG;
|
||||||
_options.customBG = (typeof customBG === 'string') ? ColorConverter.txt2color(customBG).rgb : customBG;
|
_options.customBG = (typeof customBG === 'string') ? ColorConverter.txt2color(customBG).rgb : customBG;
|
||||||
_colors = setColor(THIS.colors, _options.color, undefined, true); // THIS.colors = _colors =
|
_colors = setColor(THIS.colors, _options.color, undefined, true); // THIS.colors = _colors =
|
||||||
},
|
},
|
||||||
focusInstance = function(THIS) {
|
focusInstance = function(THIS) {
|
||||||
if (_instance !== THIS) {
|
if (_instance !== THIS) {
|
||||||
@ -170,7 +178,7 @@
|
|||||||
alpha = colors.alpha,
|
alpha = colors.alpha,
|
||||||
luminance = 'luminance',
|
luminance = 'luminance',
|
||||||
background = colors.background,
|
background = colors.background,
|
||||||
rgbaMixBlack, rgbaMixWhite, rgbaMixCustom,
|
rgbaMixBlack, rgbaMixWhite, rgbaMixCustom,
|
||||||
rgbaMixBG, rgbaMixBGMixBlack, rgbaMixBGMixWhite, rgbaMixBGMixCustom;
|
rgbaMixBG, rgbaMixBGMixBlack, rgbaMixBGMixWhite, rgbaMixBGMixCustom;
|
||||||
|
|
||||||
rgbaMixBlack = mixColors(rgb, {r: 0, g: 0, b: 0}, alpha, 1);
|
rgbaMixBlack = mixColors(rgb, {r: 0, g: 0, b: 0}, alpha, 1);
|
||||||
@ -415,4 +423,6 @@
|
|||||||
// return Math.max(min, Math.min(max, value)); // faster??
|
// return Math.max(min, Math.min(max, value)); // faster??
|
||||||
return (value > max ? max : value < min ? min : value);
|
return (value > max ? max : value < min ? min : value);
|
||||||
}
|
}
|
||||||
})(window);
|
|
||||||
|
return Colors;
|
||||||
|
}));
|
||||||
|
@ -1,4 +1,12 @@
|
|||||||
;(function(window, $, Colors, undefined){
|
(function (factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery', './colors'], function (jQuery, Colors) {
|
||||||
|
return factory(window, jQuery, Colors);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
factory(window, jQuery, Colors);
|
||||||
|
}
|
||||||
|
}(function(window, $, Colors, undefined){
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var $document = $(document),
|
var $document = $(document),
|
||||||
@ -332,4 +340,5 @@
|
|||||||
_selector = '';
|
_selector = '';
|
||||||
};
|
};
|
||||||
|
|
||||||
})(window, jQuery, Colors);
|
return $;
|
||||||
|
}));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user