@ctrl/tinycolor 3.6.0 → 3.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isValidCSSUnit = exports.stringInputToObject = exports.inputToRGB = void 0;
4
4
  /* eslint-disable @typescript-eslint/no-redundant-type-constituents */
5
- var conversion_1 = require("./conversion");
6
- var css_color_names_1 = require("./css-color-names");
7
- var util_1 = require("./util");
5
+ var conversion_js_1 = require("./conversion.js");
6
+ var css_color_names_js_1 = require("./css-color-names.js");
7
+ var util_js_1 = require("./util.js");
8
8
  /**
9
9
  * Given a string or object, convert that input to RGB
10
10
  *
@@ -36,21 +36,21 @@ function inputToRGB(color) {
36
36
  }
37
37
  if (typeof color === 'object') {
38
38
  if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
39
- rgb = (0, conversion_1.rgbToRgb)(color.r, color.g, color.b);
39
+ rgb = (0, conversion_js_1.rgbToRgb)(color.r, color.g, color.b);
40
40
  ok = true;
41
41
  format = String(color.r).substr(-1) === '%' ? 'prgb' : 'rgb';
42
42
  }
43
43
  else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
44
- s = (0, util_1.convertToPercentage)(color.s);
45
- v = (0, util_1.convertToPercentage)(color.v);
46
- rgb = (0, conversion_1.hsvToRgb)(color.h, s, v);
44
+ s = (0, util_js_1.convertToPercentage)(color.s);
45
+ v = (0, util_js_1.convertToPercentage)(color.v);
46
+ rgb = (0, conversion_js_1.hsvToRgb)(color.h, s, v);
47
47
  ok = true;
48
48
  format = 'hsv';
49
49
  }
50
50
  else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
51
- s = (0, util_1.convertToPercentage)(color.s);
52
- l = (0, util_1.convertToPercentage)(color.l);
53
- rgb = (0, conversion_1.hslToRgb)(color.h, s, l);
51
+ s = (0, util_js_1.convertToPercentage)(color.s);
52
+ l = (0, util_js_1.convertToPercentage)(color.l);
53
+ rgb = (0, conversion_js_1.hslToRgb)(color.h, s, l);
54
54
  ok = true;
55
55
  format = 'hsl';
56
56
  }
@@ -58,7 +58,7 @@ function inputToRGB(color) {
58
58
  a = color.a;
59
59
  }
60
60
  }
61
- a = (0, util_1.boundAlpha)(a);
61
+ a = (0, util_js_1.boundAlpha)(a);
62
62
  return {
63
63
  ok: ok,
64
64
  format: color.format || format,
@@ -103,8 +103,8 @@ function stringInputToObject(color) {
103
103
  return false;
104
104
  }
105
105
  var named = false;
106
- if (css_color_names_1.names[color]) {
107
- color = css_color_names_1.names[color];
106
+ if (css_color_names_js_1.names[color]) {
107
+ color = css_color_names_js_1.names[color];
108
108
  named = true;
109
109
  }
110
110
  else if (color === 'transparent') {
@@ -141,38 +141,38 @@ function stringInputToObject(color) {
141
141
  match = matchers.hex8.exec(color);
142
142
  if (match) {
143
143
  return {
144
- r: (0, conversion_1.parseIntFromHex)(match[1]),
145
- g: (0, conversion_1.parseIntFromHex)(match[2]),
146
- b: (0, conversion_1.parseIntFromHex)(match[3]),
147
- a: (0, conversion_1.convertHexToDecimal)(match[4]),
144
+ r: (0, conversion_js_1.parseIntFromHex)(match[1]),
145
+ g: (0, conversion_js_1.parseIntFromHex)(match[2]),
146
+ b: (0, conversion_js_1.parseIntFromHex)(match[3]),
147
+ a: (0, conversion_js_1.convertHexToDecimal)(match[4]),
148
148
  format: named ? 'name' : 'hex8',
149
149
  };
150
150
  }
151
151
  match = matchers.hex6.exec(color);
152
152
  if (match) {
153
153
  return {
154
- r: (0, conversion_1.parseIntFromHex)(match[1]),
155
- g: (0, conversion_1.parseIntFromHex)(match[2]),
156
- b: (0, conversion_1.parseIntFromHex)(match[3]),
154
+ r: (0, conversion_js_1.parseIntFromHex)(match[1]),
155
+ g: (0, conversion_js_1.parseIntFromHex)(match[2]),
156
+ b: (0, conversion_js_1.parseIntFromHex)(match[3]),
157
157
  format: named ? 'name' : 'hex',
158
158
  };
159
159
  }
160
160
  match = matchers.hex4.exec(color);
161
161
  if (match) {
162
162
  return {
163
- r: (0, conversion_1.parseIntFromHex)(match[1] + match[1]),
164
- g: (0, conversion_1.parseIntFromHex)(match[2] + match[2]),
165
- b: (0, conversion_1.parseIntFromHex)(match[3] + match[3]),
166
- a: (0, conversion_1.convertHexToDecimal)(match[4] + match[4]),
163
+ r: (0, conversion_js_1.parseIntFromHex)(match[1] + match[1]),
164
+ g: (0, conversion_js_1.parseIntFromHex)(match[2] + match[2]),
165
+ b: (0, conversion_js_1.parseIntFromHex)(match[3] + match[3]),
166
+ a: (0, conversion_js_1.convertHexToDecimal)(match[4] + match[4]),
167
167
  format: named ? 'name' : 'hex8',
168
168
  };
169
169
  }
170
170
  match = matchers.hex3.exec(color);
171
171
  if (match) {
172
172
  return {
173
- r: (0, conversion_1.parseIntFromHex)(match[1] + match[1]),
174
- g: (0, conversion_1.parseIntFromHex)(match[2] + match[2]),
175
- b: (0, conversion_1.parseIntFromHex)(match[3] + match[3]),
173
+ r: (0, conversion_js_1.parseIntFromHex)(match[1] + match[1]),
174
+ g: (0, conversion_js_1.parseIntFromHex)(match[2] + match[2]),
175
+ b: (0, conversion_js_1.parseIntFromHex)(match[3] + match[3]),
176
176
  format: named ? 'name' : 'hex',
177
177
  };
178
178
  }
@@ -1,4 +1,4 @@
1
- import { TinyColor } from './index';
1
+ import { TinyColor } from './index.js';
2
2
  export interface RatioInput {
3
3
  r: number | string;
4
4
  g: number | string;
@@ -1,27 +1,27 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.legacyRandom = exports.fromRatio = void 0;
4
- var index_1 = require("./index");
5
- var util_1 = require("./util");
4
+ var index_js_1 = require("./index.js");
5
+ var util_js_1 = require("./util.js");
6
6
  /**
7
7
  * If input is an object, force 1 into "1.0" to handle ratios properly
8
8
  * String input requires "1.0" as input, so 1 will be treated as 1
9
9
  */
10
10
  function fromRatio(ratio, opts) {
11
11
  var newColor = {
12
- r: (0, util_1.convertToPercentage)(ratio.r),
13
- g: (0, util_1.convertToPercentage)(ratio.g),
14
- b: (0, util_1.convertToPercentage)(ratio.b),
12
+ r: (0, util_js_1.convertToPercentage)(ratio.r),
13
+ g: (0, util_js_1.convertToPercentage)(ratio.g),
14
+ b: (0, util_js_1.convertToPercentage)(ratio.b),
15
15
  };
16
16
  if (ratio.a !== undefined) {
17
17
  newColor.a = Number(ratio.a);
18
18
  }
19
- return new index_1.TinyColor(newColor, opts);
19
+ return new index_js_1.TinyColor(newColor, opts);
20
20
  }
21
21
  exports.fromRatio = fromRatio;
22
22
  /** old random function */
23
23
  function legacyRandom() {
24
- return new index_1.TinyColor({
24
+ return new index_js_1.TinyColor({
25
25
  r: Math.random(),
26
26
  g: Math.random(),
27
27
  b: Math.random(),
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { HSL, HSLA, HSV, HSVA, Numberify, RGB, RGBA } from './interfaces';
1
+ import { HSL, HSLA, HSV, HSVA, Numberify, RGB, RGBA } from './interfaces.js';
2
2
  export interface TinyColorOptions {
3
3
  format: string;
4
4
  gradientType: string;
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.tinycolor = exports.TinyColor = void 0;
4
- var conversion_1 = require("./conversion");
5
- var css_color_names_1 = require("./css-color-names");
4
+ var conversion_js_1 = require("./conversion.js");
5
+ var css_color_names_js_1 = require("./css-color-names.js");
6
6
  var format_input_1 = require("./format-input");
7
- var util_1 = require("./util");
7
+ var util_js_1 = require("./util.js");
8
8
  var TinyColor = /** @class */ (function () {
9
9
  function TinyColor(color, opts) {
10
10
  if (color === void 0) { color = ''; }
@@ -16,7 +16,7 @@ var TinyColor = /** @class */ (function () {
16
16
  return color;
17
17
  }
18
18
  if (typeof color === 'number') {
19
- color = (0, conversion_1.numberInputToObject)(color);
19
+ color = (0, conversion_js_1.numberInputToObject)(color);
20
20
  }
21
21
  this.originalInput = color;
22
22
  var rgb = (0, format_input_1.inputToRGB)(color);
@@ -104,7 +104,7 @@ var TinyColor = /** @class */ (function () {
104
104
  * @param alpha - The new alpha value. The accepted range is 0-1.
105
105
  */
106
106
  TinyColor.prototype.setAlpha = function (alpha) {
107
- this.a = (0, util_1.boundAlpha)(alpha);
107
+ this.a = (0, util_js_1.boundAlpha)(alpha);
108
108
  this.roundA = Math.round(100 * this.a) / 100;
109
109
  return this;
110
110
  };
@@ -119,7 +119,7 @@ var TinyColor = /** @class */ (function () {
119
119
  * Returns the object as a HSVA object.
120
120
  */
121
121
  TinyColor.prototype.toHsv = function () {
122
- var hsv = (0, conversion_1.rgbToHsv)(this.r, this.g, this.b);
122
+ var hsv = (0, conversion_js_1.rgbToHsv)(this.r, this.g, this.b);
123
123
  return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this.a };
124
124
  };
125
125
  /**
@@ -127,7 +127,7 @@ var TinyColor = /** @class */ (function () {
127
127
  * "hsva(xxx, xxx, xxx, xx)".
128
128
  */
129
129
  TinyColor.prototype.toHsvString = function () {
130
- var hsv = (0, conversion_1.rgbToHsv)(this.r, this.g, this.b);
130
+ var hsv = (0, conversion_js_1.rgbToHsv)(this.r, this.g, this.b);
131
131
  var h = Math.round(hsv.h * 360);
132
132
  var s = Math.round(hsv.s * 100);
133
133
  var v = Math.round(hsv.v * 100);
@@ -137,7 +137,7 @@ var TinyColor = /** @class */ (function () {
137
137
  * Returns the object as a HSLA object.
138
138
  */
139
139
  TinyColor.prototype.toHsl = function () {
140
- var hsl = (0, conversion_1.rgbToHsl)(this.r, this.g, this.b);
140
+ var hsl = (0, conversion_js_1.rgbToHsl)(this.r, this.g, this.b);
141
141
  return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a };
142
142
  };
143
143
  /**
@@ -145,7 +145,7 @@ var TinyColor = /** @class */ (function () {
145
145
  * "hsla(xxx, xxx, xxx, xx)".
146
146
  */
147
147
  TinyColor.prototype.toHslString = function () {
148
- var hsl = (0, conversion_1.rgbToHsl)(this.r, this.g, this.b);
148
+ var hsl = (0, conversion_js_1.rgbToHsl)(this.r, this.g, this.b);
149
149
  var h = Math.round(hsl.h * 360);
150
150
  var s = Math.round(hsl.s * 100);
151
151
  var l = Math.round(hsl.l * 100);
@@ -157,7 +157,7 @@ var TinyColor = /** @class */ (function () {
157
157
  */
158
158
  TinyColor.prototype.toHex = function (allow3Char) {
159
159
  if (allow3Char === void 0) { allow3Char = false; }
160
- return (0, conversion_1.rgbToHex)(this.r, this.g, this.b, allow3Char);
160
+ return (0, conversion_js_1.rgbToHex)(this.r, this.g, this.b, allow3Char);
161
161
  };
162
162
  /**
163
163
  * Returns the hex value of the color -with a # prefixed.
@@ -173,7 +173,7 @@ var TinyColor = /** @class */ (function () {
173
173
  */
174
174
  TinyColor.prototype.toHex8 = function (allow4Char) {
175
175
  if (allow4Char === void 0) { allow4Char = false; }
176
- return (0, conversion_1.rgbaToHex)(this.r, this.g, this.b, this.a, allow4Char);
176
+ return (0, conversion_js_1.rgbaToHex)(this.r, this.g, this.b, this.a, allow4Char);
177
177
  };
178
178
  /**
179
179
  * Returns the hex 8 value of the color -with a # prefixed.
@@ -216,7 +216,7 @@ var TinyColor = /** @class */ (function () {
216
216
  * Returns the object as a RGBA object.
217
217
  */
218
218
  TinyColor.prototype.toPercentageRgb = function () {
219
- var fmt = function (x) { return "".concat(Math.round((0, util_1.bound01)(x, 255) * 100), "%"); };
219
+ var fmt = function (x) { return "".concat(Math.round((0, util_js_1.bound01)(x, 255) * 100), "%"); };
220
220
  return {
221
221
  r: fmt(this.r),
222
222
  g: fmt(this.g),
@@ -228,7 +228,7 @@ var TinyColor = /** @class */ (function () {
228
228
  * Returns the RGBA relative values interpolated into a string
229
229
  */
230
230
  TinyColor.prototype.toPercentageRgbString = function () {
231
- var rnd = function (x) { return Math.round((0, util_1.bound01)(x, 255) * 100); };
231
+ var rnd = function (x) { return Math.round((0, util_js_1.bound01)(x, 255) * 100); };
232
232
  return this.a === 1
233
233
  ? "rgb(".concat(rnd(this.r), "%, ").concat(rnd(this.g), "%, ").concat(rnd(this.b), "%)")
234
234
  : "rgba(".concat(rnd(this.r), "%, ").concat(rnd(this.g), "%, ").concat(rnd(this.b), "%, ").concat(this.roundA, ")");
@@ -243,8 +243,8 @@ var TinyColor = /** @class */ (function () {
243
243
  if (this.a < 1) {
244
244
  return false;
245
245
  }
246
- var hex = '#' + (0, conversion_1.rgbToHex)(this.r, this.g, this.b, false);
247
- for (var _i = 0, _a = Object.entries(css_color_names_1.names); _i < _a.length; _i++) {
246
+ var hex = '#' + (0, conversion_js_1.rgbToHex)(this.r, this.g, this.b, false);
247
+ for (var _i = 0, _a = Object.entries(css_color_names_js_1.names); _i < _a.length; _i++) {
248
248
  var _b = _a[_i], key = _b[0], value = _b[1];
249
249
  if (hex === value) {
250
250
  return key;
@@ -309,7 +309,7 @@ var TinyColor = /** @class */ (function () {
309
309
  if (amount === void 0) { amount = 10; }
310
310
  var hsl = this.toHsl();
311
311
  hsl.l += amount / 100;
312
- hsl.l = (0, util_1.clamp01)(hsl.l);
312
+ hsl.l = (0, util_js_1.clamp01)(hsl.l);
313
313
  return new TinyColor(hsl);
314
314
  };
315
315
  /**
@@ -333,7 +333,7 @@ var TinyColor = /** @class */ (function () {
333
333
  if (amount === void 0) { amount = 10; }
334
334
  var hsl = this.toHsl();
335
335
  hsl.l -= amount / 100;
336
- hsl.l = (0, util_1.clamp01)(hsl.l);
336
+ hsl.l = (0, util_js_1.clamp01)(hsl.l);
337
337
  return new TinyColor(hsl);
338
338
  };
339
339
  /**
@@ -363,7 +363,7 @@ var TinyColor = /** @class */ (function () {
363
363
  if (amount === void 0) { amount = 10; }
364
364
  var hsl = this.toHsl();
365
365
  hsl.s -= amount / 100;
366
- hsl.s = (0, util_1.clamp01)(hsl.s);
366
+ hsl.s = (0, util_js_1.clamp01)(hsl.s);
367
367
  return new TinyColor(hsl);
368
368
  };
369
369
  /**
@@ -374,7 +374,7 @@ var TinyColor = /** @class */ (function () {
374
374
  if (amount === void 0) { amount = 10; }
375
375
  var hsl = this.toHsl();
376
376
  hsl.s += amount / 100;
377
- hsl.s = (0, util_1.clamp01)(hsl.s);
377
+ hsl.s = (0, util_js_1.clamp01)(hsl.s);
378
378
  return new TinyColor(hsl);
379
379
  };
380
380
  /**
@@ -1,4 +1,4 @@
1
- import { bound01, pad2 } from './util';
1
+ import { bound01, pad2 } from './util.js';
2
2
  // `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from:
3
3
  // <http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript>
4
4
  /**
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable @typescript-eslint/no-redundant-type-constituents */
2
- import { convertHexToDecimal, hslToRgb, hsvToRgb, parseIntFromHex, rgbToRgb } from './conversion';
3
- import { names } from './css-color-names';
4
- import { boundAlpha, convertToPercentage } from './util';
2
+ import { convertHexToDecimal, hslToRgb, hsvToRgb, parseIntFromHex, rgbToRgb, } from './conversion.js';
3
+ import { names } from './css-color-names.js';
4
+ import { boundAlpha, convertToPercentage } from './util.js';
5
5
  /**
6
6
  * Given a string or object, convert that input to RGB
7
7
  *
@@ -1,5 +1,5 @@
1
- import { TinyColor } from './index';
2
- import { convertToPercentage } from './util';
1
+ import { TinyColor } from './index.js';
2
+ import { convertToPercentage } from './util.js';
3
3
  /**
4
4
  * If input is an object, force 1 into "1.0" to handle ratios properly
5
5
  * String input requires "1.0" as input, so 1 will be treated as 1
@@ -1,7 +1,7 @@
1
- import { numberInputToObject, rgbaToHex, rgbToHex, rgbToHsl, rgbToHsv } from './conversion';
2
- import { names } from './css-color-names';
1
+ import { numberInputToObject, rgbaToHex, rgbToHex, rgbToHsl, rgbToHsv } from './conversion.js';
2
+ import { names } from './css-color-names.js';
3
3
  import { inputToRGB } from './format-input';
4
- import { bound01, boundAlpha, clamp01 } from './util';
4
+ import { bound01, boundAlpha, clamp01 } from './util.js';
5
5
  var TinyColor = /** @class */ (function () {
6
6
  function TinyColor(color, opts) {
7
7
  if (color === void 0) { color = ''; }
@@ -1,12 +1,12 @@
1
- import { tinycolor } from './index';
2
- export * from './index';
3
- export * from './css-color-names';
4
- export * from './readability';
5
- export * from './to-ms-filter';
6
- export * from './from-ratio';
7
- export * from './format-input';
8
- export * from './random';
9
- export * from './interfaces';
10
- export * from './conversion';
1
+ import { tinycolor } from './index.js';
2
+ export * from './index.js';
3
+ export * from './css-color-names.js';
4
+ export * from './readability.js';
5
+ export * from './to-ms-filter.js';
6
+ export * from './from-ratio.js';
7
+ export * from './format-input.js';
8
+ export * from './random.js';
9
+ export * from './interfaces.js';
10
+ export * from './conversion.js';
11
11
  // kept for backwards compatability with v1
12
12
  export default tinycolor;
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable @typescript-eslint/no-redundant-type-constituents */
2
2
  // randomColor by David Merfield under the CC0 license
3
3
  // https://github.com/davidmerfield/randomColor/
4
- import { TinyColor } from './index';
4
+ import { TinyColor } from './index.js';
5
5
  export function random(options) {
6
6
  if (options === void 0) { options = {}; }
7
7
  // Check if we need to generate multiple colors
@@ -1,4 +1,4 @@
1
- import { TinyColor } from './index';
1
+ import { TinyColor } from './index.js';
2
2
  // Readability Functions
3
3
  // ---------------------
4
4
  // <http://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef (WCAG Version 2)
@@ -1,5 +1,5 @@
1
- import { rgbaToArgbHex } from './conversion';
2
- import { TinyColor } from './index';
1
+ import { rgbaToArgbHex } from './conversion.js';
2
+ import { TinyColor } from './index.js';
3
3
  /**
4
4
  * Returns the color represented as a Microsoft filter for use in old versions of IE.
5
5
  */
@@ -1,10 +1,10 @@
1
- import { names } from './css-color-names';
2
- import { inputToRGB, isValidCSSUnit, stringInputToObject } from './format-input';
3
- import { fromRatio, legacyRandom } from './from-ratio';
4
- import { TinyColor, tinycolor } from './index';
5
- import { random } from './random';
6
- import { mostReadable, readability } from './readability';
7
- import { toMsFilter } from './to-ms-filter';
1
+ import { names } from './css-color-names.js';
2
+ import { inputToRGB, isValidCSSUnit, stringInputToObject } from './format-input.js';
3
+ import { fromRatio, legacyRandom } from './from-ratio.js';
4
+ import { TinyColor, tinycolor } from './index.js';
5
+ import { random } from './random.js';
6
+ import { mostReadable, readability } from './readability.js';
7
+ import { toMsFilter } from './to-ms-filter.js';
8
8
  var tinycolorumd = tinycolor;
9
9
  tinycolorumd.TinyColor = TinyColor;
10
10
  tinycolorumd.readability = readability;
@@ -1,11 +1,11 @@
1
- import { tinycolor } from './index';
2
- export * from './index';
3
- export * from './css-color-names';
4
- export * from './readability';
5
- export * from './to-ms-filter';
6
- export * from './from-ratio';
7
- export * from './format-input';
8
- export * from './random';
9
- export * from './interfaces';
10
- export * from './conversion';
1
+ import { tinycolor } from './index.js';
2
+ export * from './index.js';
3
+ export * from './css-color-names.js';
4
+ export * from './readability.js';
5
+ export * from './to-ms-filter.js';
6
+ export * from './from-ratio.js';
7
+ export * from './format-input.js';
8
+ export * from './random.js';
9
+ export * from './interfaces.js';
10
+ export * from './conversion.js';
11
11
  export default tinycolor;
@@ -14,15 +14,15 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- var index_1 = require("./index");
18
- __exportStar(require("./index"), exports);
19
- __exportStar(require("./css-color-names"), exports);
20
- __exportStar(require("./readability"), exports);
21
- __exportStar(require("./to-ms-filter"), exports);
22
- __exportStar(require("./from-ratio"), exports);
23
- __exportStar(require("./format-input"), exports);
24
- __exportStar(require("./random"), exports);
25
- __exportStar(require("./interfaces"), exports);
26
- __exportStar(require("./conversion"), exports);
17
+ var index_js_1 = require("./index.js");
18
+ __exportStar(require("./index.js"), exports);
19
+ __exportStar(require("./css-color-names.js"), exports);
20
+ __exportStar(require("./readability.js"), exports);
21
+ __exportStar(require("./to-ms-filter.js"), exports);
22
+ __exportStar(require("./from-ratio.js"), exports);
23
+ __exportStar(require("./format-input.js"), exports);
24
+ __exportStar(require("./random.js"), exports);
25
+ __exportStar(require("./interfaces.js"), exports);
26
+ __exportStar(require("./conversion.js"), exports);
27
27
  // kept for backwards compatability with v1
28
- exports.default = index_1.tinycolor;
28
+ exports.default = index_js_1.tinycolor;
package/dist/random.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { TinyColor } from './index';
1
+ import { TinyColor } from './index.js';
2
2
  export interface RandomOptions {
3
3
  seed?: number;
4
4
  hue?: number | string | 'red' | 'orange' | 'yellow' | 'green' | 'blue' | 'purple' | 'pink' | 'monochrome';
package/dist/random.js CHANGED
@@ -4,7 +4,7 @@ exports.bounds = exports.random = void 0;
4
4
  /* eslint-disable @typescript-eslint/no-redundant-type-constituents */
5
5
  // randomColor by David Merfield under the CC0 license
6
6
  // https://github.com/davidmerfield/randomColor/
7
- var index_1 = require("./index");
7
+ var index_js_1 = require("./index.js");
8
8
  function random(options) {
9
9
  if (options === void 0) { options = {}; }
10
10
  // Check if we need to generate multiple colors
@@ -37,7 +37,7 @@ function random(options) {
37
37
  res.a = options.alpha;
38
38
  }
39
39
  // Then we return the HSB color in the desired format
40
- return new index_1.TinyColor(res);
40
+ return new index_js_1.TinyColor(res);
41
41
  }
42
42
  exports.random = random;
43
43
  function pickHue(hue, seed) {
@@ -122,7 +122,7 @@ function getHueRange(colorInput) {
122
122
  return color.hueRange;
123
123
  }
124
124
  }
125
- var parsed = new index_1.TinyColor(colorInput);
125
+ var parsed = new index_js_1.TinyColor(colorInput);
126
126
  if (parsed.isValid) {
127
127
  var hue = parsed.toHsv().h;
128
128
  return [hue, hue];
@@ -1,4 +1,4 @@
1
- import { ColorInput, TinyColor } from './index';
1
+ import { ColorInput, TinyColor } from './index.js';
2
2
  /**
3
3
  * AKA `contrast`
4
4
  *
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.mostReadable = exports.isReadable = exports.readability = void 0;
4
- var index_1 = require("./index");
4
+ var index_js_1 = require("./index.js");
5
5
  // Readability Functions
6
6
  // ---------------------
7
7
  // <http://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef (WCAG Version 2)
@@ -11,8 +11,8 @@ var index_1 = require("./index");
11
11
  * Analyze the 2 colors and returns the color contrast defined by (WCAG Version 2)
12
12
  */
13
13
  function readability(color1, color2) {
14
- var c1 = new index_1.TinyColor(color1);
15
- var c2 = new index_1.TinyColor(color2);
14
+ var c1 = new index_js_1.TinyColor(color1);
15
+ var c2 = new index_js_1.TinyColor(color2);
16
16
  return ((Math.max(c1.getLuminance(), c2.getLuminance()) + 0.05) /
17
17
  (Math.min(c1.getLuminance(), c2.getLuminance()) + 0.05));
18
18
  }
@@ -74,7 +74,7 @@ function mostReadable(baseColor, colorList, args) {
74
74
  var score = readability(baseColor, color);
75
75
  if (score > bestScore) {
76
76
  bestScore = score;
77
- bestColor = new index_1.TinyColor(color);
77
+ bestColor = new index_js_1.TinyColor(color);
78
78
  }
79
79
  }
80
80
  if (isReadable(baseColor, bestColor, { level: level, size: size }) || !includeFallbackColors) {
@@ -1,4 +1,4 @@
1
- import { ColorInput } from './index';
1
+ import { ColorInput } from './index.js';
2
2
  /**
3
3
  * Returns the color represented as a Microsoft filter for use in old versions of IE.
4
4
  */
@@ -1,19 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.toMsFilter = void 0;
4
- var conversion_1 = require("./conversion");
5
- var index_1 = require("./index");
4
+ var conversion_js_1 = require("./conversion.js");
5
+ var index_js_1 = require("./index.js");
6
6
  /**
7
7
  * Returns the color represented as a Microsoft filter for use in old versions of IE.
8
8
  */
9
9
  function toMsFilter(firstColor, secondColor) {
10
- var color = new index_1.TinyColor(firstColor);
11
- var hex8String = '#' + (0, conversion_1.rgbaToArgbHex)(color.r, color.g, color.b, color.a);
10
+ var color = new index_js_1.TinyColor(firstColor);
11
+ var hex8String = '#' + (0, conversion_js_1.rgbaToArgbHex)(color.r, color.g, color.b, color.a);
12
12
  var secondHex8String = hex8String;
13
13
  var gradientType = color.gradientType ? 'GradientType = 1, ' : '';
14
14
  if (secondColor) {
15
- var s = new index_1.TinyColor(secondColor);
16
- secondHex8String = '#' + (0, conversion_1.rgbaToArgbHex)(s.r, s.g, s.b, s.a);
15
+ var s = new index_js_1.TinyColor(secondColor);
16
+ secondHex8String = '#' + (0, conversion_js_1.rgbaToArgbHex)(s.r, s.g, s.b, s.a);
17
17
  }
18
18
  return "progid:DXImageTransform.Microsoft.gradient(".concat(gradientType, "startColorstr=").concat(hex8String, ",endColorstr=").concat(secondHex8String, ")");
19
19
  }
package/dist/umd_api.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { names } from './css-color-names';
2
- import { inputToRGB, isValidCSSUnit, stringInputToObject } from './format-input';
3
- import { fromRatio, legacyRandom } from './from-ratio';
4
- import { TinyColor } from './index';
5
- import { random } from './random';
6
- import { mostReadable, readability } from './readability';
7
- import { toMsFilter } from './to-ms-filter';
1
+ import { names } from './css-color-names.js';
2
+ import { inputToRGB, isValidCSSUnit, stringInputToObject } from './format-input.js';
3
+ import { fromRatio, legacyRandom } from './from-ratio.js';
4
+ import { TinyColor } from './index.js';
5
+ import { random } from './random.js';
6
+ import { mostReadable, readability } from './readability.js';
7
+ import { toMsFilter } from './to-ms-filter.js';
8
8
  export interface TinyColorUMD {
9
9
  (): TinyColor;
10
10
  TinyColor: typeof TinyColor;
package/dist/umd_api.js CHANGED
@@ -1,22 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var css_color_names_1 = require("./css-color-names");
4
- var format_input_1 = require("./format-input");
5
- var from_ratio_1 = require("./from-ratio");
6
- var index_1 = require("./index");
7
- var random_1 = require("./random");
8
- var readability_1 = require("./readability");
9
- var to_ms_filter_1 = require("./to-ms-filter");
10
- var tinycolorumd = index_1.tinycolor;
11
- tinycolorumd.TinyColor = index_1.TinyColor;
12
- tinycolorumd.readability = readability_1.readability;
13
- tinycolorumd.mostReadable = readability_1.mostReadable;
14
- tinycolorumd.random = random_1.random;
15
- tinycolorumd.names = css_color_names_1.names;
16
- tinycolorumd.fromRatio = from_ratio_1.fromRatio;
17
- tinycolorumd.legacyRandom = from_ratio_1.legacyRandom;
18
- tinycolorumd.toMsFilter = to_ms_filter_1.toMsFilter;
19
- tinycolorumd.inputToRGB = format_input_1.inputToRGB;
20
- tinycolorumd.stringInputToObject = format_input_1.stringInputToObject;
21
- tinycolorumd.isValidCSSUnit = format_input_1.isValidCSSUnit;
3
+ var css_color_names_js_1 = require("./css-color-names.js");
4
+ var format_input_js_1 = require("./format-input.js");
5
+ var from_ratio_js_1 = require("./from-ratio.js");
6
+ var index_js_1 = require("./index.js");
7
+ var random_js_1 = require("./random.js");
8
+ var readability_js_1 = require("./readability.js");
9
+ var to_ms_filter_js_1 = require("./to-ms-filter.js");
10
+ var tinycolorumd = index_js_1.tinycolor;
11
+ tinycolorumd.TinyColor = index_js_1.TinyColor;
12
+ tinycolorumd.readability = readability_js_1.readability;
13
+ tinycolorumd.mostReadable = readability_js_1.mostReadable;
14
+ tinycolorumd.random = random_js_1.random;
15
+ tinycolorumd.names = css_color_names_js_1.names;
16
+ tinycolorumd.fromRatio = from_ratio_js_1.fromRatio;
17
+ tinycolorumd.legacyRandom = from_ratio_js_1.legacyRandom;
18
+ tinycolorumd.toMsFilter = to_ms_filter_js_1.toMsFilter;
19
+ tinycolorumd.inputToRGB = format_input_js_1.inputToRGB;
20
+ tinycolorumd.stringInputToObject = format_input_js_1.stringInputToObject;
21
+ tinycolorumd.isValidCSSUnit = format_input_js_1.isValidCSSUnit;
22
22
  exports.default = tinycolorumd;