@ctrl/tinycolor 3.3.1 → 3.3.2

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.
package/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
 
10
10
  A fork of [tinycolor2](https://github.com/bgrins/TinyColor) by [Brian Grinstead](https://github.com/bgrins)
11
11
 
12
- __DEMO__: https://tinycolor.netlify.app
12
+ __DEMO__: https://tinycolor.vercel.app
13
13
 
14
14
  ### Changes from tinycolor2
15
15
 
@@ -238,6 +238,16 @@ color.getAlpha(); // .5
238
238
  color.toRgbString(); // "rgba(255, 0, 0, .5)"
239
239
  ```
240
240
 
241
+ ### onBackground
242
+
243
+ Compute how the color would appear on a background. When the color is fully transparent (i.e. `getAlpha() == 0`), the result will be the background color. When the color is not transparent at all (i.e. `getAlpha() == 1`), the result will be the color itself. Otherwise you will get a computed result.
244
+
245
+ ```ts
246
+ const color = new TinyColor('rgba(255, 0, 0, .5)');
247
+ const computedColor = color.onBackground('rgb(0, 0, 255)');
248
+ computedColor.toRgbString(); // "rgb(128, 0, 128)"
249
+ ```
250
+
241
251
  ### String Representations
242
252
 
243
253
  The following methods will return a property for the `alpha` value, which can be ignored: `toHsv`, `toHsl`, `toRgb`
package/dist/index.d.ts CHANGED
@@ -43,7 +43,7 @@ export declare class TinyColor {
43
43
  *
44
44
  * @param alpha - The new alpha value. The accepted range is 0-1.
45
45
  */
46
- setAlpha(alpha?: string | number): TinyColor;
46
+ setAlpha(alpha?: string | number): this;
47
47
  /**
48
48
  * Returns the object as a HSVA object.
49
49
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ctrl/tinycolor",
3
- "version": "3.3.1",
3
+ "version": "3.3.2",
4
4
  "description": "Fast, small color manipulation and conversion for JavaScript",
5
5
  "author": "Scott Cooper <scttcper@gmail.com>",
6
6
  "publishConfig": {
@@ -31,7 +31,7 @@
31
31
  "lint:fix": "eslint --fix --ext .js,.ts, .",
32
32
  "prepare": "npm run build",
33
33
  "build": "del-cli dist && tsc -p tsconfig.build.json && tsc -p tsconfig.module.json && ts-node build",
34
- "build:docs": "typedoc --out demo/public/docs --hideGenerator --target ES6 --mode file src",
34
+ "build:docs": "typedoc --out demo/public/docs --hideGenerator --tsconfig tsconfig.build.json src/public_api.ts",
35
35
  "test": "jest",
36
36
  "test:ci": "jest --ci --runInBand --reporters=default --reporters=jest-junit --coverage",
37
37
  "test:watch": "jest --watch"
@@ -42,11 +42,11 @@
42
42
  "@babel/preset-typescript": "7.12.7",
43
43
  "@ctrl/eslint-config": "1.2.8",
44
44
  "@jest/globals": "26.6.2",
45
- "@types/node": "14.14.13",
45
+ "@types/node": "14.14.16",
46
46
  "del-cli": "3.0.1",
47
47
  "jest": "26.6.3",
48
48
  "jest-junit": "12.0.0",
49
- "rollup": "2.34.2",
49
+ "rollup": "2.35.1",
50
50
  "rollup-plugin-livereload": "2.0.0",
51
51
  "rollup-plugin-serve": "1.1.0",
52
52
  "rollup-plugin-sourcemaps": "0.6.3",
@@ -54,7 +54,7 @@
54
54
  "rollup-plugin-typescript2": "0.29.0",
55
55
  "rollup-plugin-uglify": "6.0.4",
56
56
  "ts-node": "9.1.1",
57
- "typedoc": "0.19.2",
57
+ "typedoc": "0.20.4",
58
58
  "typescript": "4.1.3"
59
59
  },
60
60
  "jest": {