color-map 0.5.10 → 1.1.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.
Files changed (51) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +28 -38
  3. package/dist/color-map.es5.js +1 -1
  4. package/package.json +67 -71
  5. package/ts/createColors.spec.ts +176 -0
  6. package/ts/createColors.ts +35 -0
  7. package/ts/createColorsFromMap.spec.ts +11 -0
  8. package/ts/createColorsFromMap.ts +26 -0
  9. package/ts/index.ts +5 -0
  10. package/ts/interfaces.ts +15 -0
  11. package/ts/rgbHex.spec.ts +17 -0
  12. package/ts/rgbHex.ts +18 -0
  13. package/ts/rgbaString.spec.ts +9 -0
  14. package/ts/rgbaString.ts +5 -0
  15. package/dist/color-map.es5.js.map +0 -1
  16. package/dist-es2015/createColors.d.ts +0 -2
  17. package/dist-es2015/createColors.js +0 -24
  18. package/dist-es2015/createColors.js.map +0 -1
  19. package/dist-es2015/createColorsFromMap.d.ts +0 -5
  20. package/dist-es2015/createColorsFromMap.js +0 -22
  21. package/dist-es2015/createColorsFromMap.js.map +0 -1
  22. package/dist-es2015/index.d.ts +0 -5
  23. package/dist-es2015/index.js +0 -5
  24. package/dist-es2015/index.js.map +0 -1
  25. package/dist-es2015/interfaces.d.ts +0 -14
  26. package/dist-es2015/interfaces.js +0 -1
  27. package/dist-es2015/interfaces.js.map +0 -1
  28. package/dist-es2015/rgbHex.d.ts +0 -6
  29. package/dist-es2015/rgbHex.js +0 -16
  30. package/dist-es2015/rgbHex.js.map +0 -1
  31. package/dist-es2015/rgbaString.d.ts +0 -2
  32. package/dist-es2015/rgbaString.js +0 -4
  33. package/dist-es2015/rgbaString.js.map +0 -1
  34. package/dist-es5/createColors.d.ts +0 -2
  35. package/dist-es5/createColors.js +0 -28
  36. package/dist-es5/createColors.js.map +0 -1
  37. package/dist-es5/createColorsFromMap.d.ts +0 -5
  38. package/dist-es5/createColorsFromMap.js +0 -25
  39. package/dist-es5/createColorsFromMap.js.map +0 -1
  40. package/dist-es5/index.d.ts +0 -5
  41. package/dist-es5/index.js +0 -10
  42. package/dist-es5/index.js.map +0 -1
  43. package/dist-es5/interfaces.d.ts +0 -14
  44. package/dist-es5/interfaces.js +0 -3
  45. package/dist-es5/interfaces.js.map +0 -1
  46. package/dist-es5/rgbHex.d.ts +0 -6
  47. package/dist-es5/rgbHex.js +0 -19
  48. package/dist-es5/rgbHex.js.map +0 -1
  49. package/dist-es5/rgbaString.d.ts +0 -2
  50. package/dist-es5/rgbaString.js +0 -7
  51. package/dist-es5/rgbaString.js.map +0 -1
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2017 unional, Homa Wong (homawong@gmail.com)
3
+ Copyright (c) 2017 Homa Wong (unional) (homawong@gmail.com)
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -2,10 +2,17 @@
2
2
 
3
3
  [![NPM version][npm-image]][npm-url]
4
4
  [![NPM downloads][downloads-image]][downloads-url]
5
- [![Build status][travis-image]][travis-url]
6
- [![Coverage Status][coveralls-image]][coveralls-url]
7
- [![Greenkeeper badge](https://badges.greenkeeper.io/unional/color-map.svg)](https://greenkeeper.io/)
8
- ![badge-size-es5-url]
5
+
6
+ [![Circle CI][circleci-image]][circleci-url]
7
+ [![Travis CI][travis-image]][travis-url]
8
+ [![Codecov][codecov-image]][codecov-url]
9
+ [![Coveralls Status][coveralls-image]][coveralls-url]
10
+
11
+ [![Greenkeeper][greenkeeper-image]][greenkeeper-url]
12
+ [![Semantic Release][semantic-release-image]][semantic-release-url]
13
+
14
+ [![Visual Studio Code][vscode-image]][vscode-url]
15
+ [![Wallaby.js][wallaby-image]][wallaby-url]
9
16
 
10
17
  Color map generator with no dependency.
11
18
 
@@ -54,15 +61,13 @@ const colors = createColorsFromMap(summer, 60)
54
61
  ## Contribute
55
62
 
56
63
  ```sh
57
- # after fork
64
+ # after fork and clone
58
65
  npm install
59
66
 
60
67
  # begin making changes
61
68
  git checkout -b <branch>
62
69
  npm run watch
63
70
 
64
- # edit `webpack.config.dev.js` to exclude dependencies for the global build.
65
-
66
71
  # after making change(s)
67
72
  git commit -m "<commit message>"
68
73
  git push
@@ -70,38 +75,23 @@ git push
70
75
  # create PR
71
76
  ```
72
77
 
73
- ## Npm Commands
74
-
75
- There are a few useful commands you can use during development.
76
-
77
- ```sh
78
- # Run tests (and lint) automatically whenever you save a file.
79
- npm run watch
80
-
81
- # Run tests with coverage stats (but won't fail you if coverage does not meet criteria)
82
- npm run test
83
-
84
- # Manually verify the project.
85
- # This will be ran during 'npm preversion' so you normally don't need to run this yourself.
86
- npm run verify
87
-
88
- # Build the project.
89
- # You normally don't need to do this.
90
- npm run build
91
-
92
- # Run tslint
93
- # You normally don't need to do this as `npm run watch` and `npm version` will automatically run lint for you.
94
- npm run lint
95
- ```
96
-
97
- Generated by [`generator-unional@0.3.1`](https://github.com/unional/unional-cli)
98
-
99
- [npm-image]: https://img.shields.io/npm/v/color-map.svg?style=flat
100
- [npm-url]: https://npmjs.org/package/color-map
78
+ [circleci-image]: https://circleci.com/gh/unional/color-map/tree/master.svg?style=shield
79
+ [circleci-url]: https://circleci.com/gh/unional/color-map/tree/master
80
+ [codecov-image]: https://codecov.io/gh/unional/color-map/branch/master/graph/badge.svg
81
+ [codecov-url]: https://codecov.io/gh/unional/color-map
82
+ [coveralls-image]: https://coveralls.io/repos/github/unional/color-map/badge.svg?branch=master
83
+ [coveralls-url]: https://coveralls.io/github/unional/color-map?branch=master
101
84
  [downloads-image]: https://img.shields.io/npm/dm/color-map.svg?style=flat
102
85
  [downloads-url]: https://npmjs.org/package/color-map
86
+ [greenkeeper-image]: https://badges.greenkeeper.io/unional/color-map.svg
87
+ [greenkeeper-url]: https://greenkeeper.io/
88
+ [npm-image]: https://img.shields.io/npm/v/color-map.svg?style=flat
89
+ [npm-url]: https://npmjs.org/package/color-map
90
+ [semantic-release-image]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg
91
+ [semantic-release-url]: https://github.com/semantic-release/semantic-release
103
92
  [travis-image]: https://img.shields.io/travis/unional/color-map/master.svg?style=flat
104
93
  [travis-url]: https://travis-ci.org/unional/color-map?branch=master
105
- [coveralls-image]: https://coveralls.io/repos/github/unional/color-map/badge.svg
106
- [coveralls-url]: https://coveralls.io/github/unional/color-map
107
- [badge-size-es5-url]: http://img.badgesize.io/unional/color-map/master/dist/color-map.es5.js.svg?label=es5_size
94
+ [vscode-image]: https://img.shields.io/badge/vscode-ready-green.svg
95
+ [vscode-url]: https://code.visualstudio.com/
96
+ [wallaby-image]: https://img.shields.io/badge/wallaby.js-configured-green.svg
97
+ [wallaby-url]: https://wallabyjs.com
@@ -1,2 +1,2 @@
1
- var ColorMap=function(r){function e(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return r[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var t={};return e.m=r,e.c=t,e.d=function(r,t,n){e.o(r,t)||Object.defineProperty(r,t,{configurable:!1,enumerable:!0,get:n})},e.n=function(r){var t=r&&r.__esModule?function(){return r.default}:function(){return r};return e.d(t,"a",t),t},e.o=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)},e.p="",e(e.s=1)}([function(r,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createColors=function(r,e,t,n){void 0===n&&(n=[1,1]);var o=[],u=r.slice(),a=[e[0]-r[0],e[1]-r[1],e[2]-r[2]];u.push(n[0]),a.push(n[1]-n[0]);for(var i=1/Math.max(t-1,1),c=0;c<t;c++){var s=[Math.round(u[0]+c*a[0]*i),Math.round(u[1]+c*a[1]*i),Math.round(u[2]+c*a[2]*i),u[3]+c*a[3]*i];o.push(s)}return o}},function(r,e,t){"use strict";function n(r){for(var t in r)e.hasOwnProperty(t)||(e[t]=r[t])}Object.defineProperty(e,"__esModule",{value:!0}),n(t(0)),n(t(2)),n(t(3)),n(t(4))},function(r,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=t(0);e.createColorsFromMap=function(r,e,t){if(e<r.length)throw new Error("Requires at least "+r.length+" shades.");for(var o=[],u=[],a=0;a<r.length;a++)u.push(Math.round(r[a].index*e));for(a=0;a<r.length-1;a++){var i=u[a+1]-u[a],c=r[a].rgb,s=r[a+1].rgb;o.push.apply(o,n.createColors(c,s,i,t))}return o}},function(r,e,t){"use strict";function n(r){var e=(+r).toString(16);return e.length<2?"0"+e:e}Object.defineProperty(e,"__esModule",{value:!0}),e.rgbHex=function(r){for(var e="#",t=0;t<3;t++)e+=n(r[t]);return e}},function(r,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.rgbaString=function(r){return"rgba("+r.join(",")+")"}}]);
1
+ var ColorMap=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1)}([function(e,t,r){"use strict";var n=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,o=0,u=t.length;o<u;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.createColors=void 0,t.createColors=function(e,t,r,o){void 0===o&&(o=[4===e.length?e[3]:4===t.length?t[3]:1,4===t.length?t[3]:4===e.length?e[3]:1]);var u=n([],e,!0),i=[t[0]-e[0],t[1]-e[1],t[2]-e[2],o[1]-o[0]];3===u.length&&u.push(o[0]);for(var a=1/Math.max(r-1,1),c=[],l=0;l<r;l++){var f=[Math.round(u[0]+l*i[0]*a),Math.round(u[1]+l*i[1]*a),Math.round(u[2]+l*i[2]*a),u[3]+l*i[3]*a];c.push(f)}return c}},function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(0),t),o(r(2),t),o(r(3),t),o(r(4),t),o(r(5),t)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createColorsFromMap=void 0;var n=r(0);t.createColorsFromMap=function(e,t,r){if(t<e.length)throw new Error("Requires at least ".concat(e.length," shades."));for(var o=[],u=[],i=0;i<e.length;i++)u.push(Math.round(e[i].index*t));for(i=0;i<e.length-1;i++){var a=u[i+1]-u[i],c=e[i].rgb,l=e[i+1].rgb;o.push.apply(o,(0,n.createColors)(c,l,a,r))}return o}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.rgbHex=void 0,t.rgbHex=function(e){for(var t,r,n="#",o=0;o<3;o++)n+=(t=e[o],r=void 0,(r=(+t).toString(16)).length<2?"0"+r:r);return n}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.rgbaString=void 0,t.rgbaString=function(e){return"rgba("+e.join(",")+")"}}]);
2
2
  //# sourceMappingURL=color-map.es5.js.map
package/package.json CHANGED
@@ -1,35 +1,7 @@
1
1
  {
2
2
  "name": "color-map",
3
+ "version": "1.1.1",
3
4
  "description": "Color map generator",
4
- "version": "0.5.10",
5
- "main": "dist-es5/index.js",
6
- "module": "dist-es2015/index.js",
7
- "typings": "dist-es5/index.d.ts",
8
- "files": [
9
- "dist",
10
- "dist-es5",
11
- "dist-es2015"
12
- ],
13
- "scripts": {
14
- "build": "npm run clean && npm run build-es5 && npm run build-es2015",
15
- "build-es5": "tsc -p tsconfig.es5.json",
16
- "build-es2015": "tsc -p tsconfig.es2015.json",
17
- "bundle": "webpack",
18
- "clean": "rimraf dist dist-es5 dist-es2015",
19
- "coverage": "nyc npm test",
20
- "coveralls": "nyc report --reporter=text-lcov | coveralls",
21
- "dependency-check": "dependency-check . --unused --no-dev && dependency-check . --missing --no-dev",
22
- "lint": "tslint -p tsconfig.json 'src/**/*.ts'",
23
- "postpublish": "git push",
24
- "preversion": "git pull && npm run verify",
25
- "test": "npm run clean && tsc && ava",
26
- "verify": "npm run lint && npm run coverage && npm run build && npm run bundle && npm run dependency-check",
27
- "watch": "npm run clean && node scripts/watch.js"
28
- },
29
- "author": {
30
- "name": "Homa Wong",
31
- "email": "homawong@gmail.com"
32
- },
33
5
  "homepage": "https://github.com/unional/color-map",
34
6
  "bugs": {
35
7
  "url": "https://github.com/unional/color-map/issues"
@@ -39,51 +11,75 @@
39
11
  "url": "https://github.com/unional/color-map.git"
40
12
  },
41
13
  "license": "MIT",
42
- "ava": {
43
- "files": [
44
- "dist-es5/**/*.spec.js"
45
- ],
46
- "source": [
47
- "scripts/*.js",
48
- "dist-es5/**/*.js",
49
- "*.json"
50
- ]
14
+ "author": {
15
+ "name": "Homa Wong (unional)",
16
+ "email": "homawong@gmail.com"
51
17
  },
52
- "nyc": {
53
- "exclude": [
54
- "scripts",
55
- "**/*.spec.*",
56
- "**/fixtures/**/*"
57
- ]
18
+ "main": "cjs/index.js",
19
+ "module": "esm/index.js",
20
+ "jsnext:main": "esm/index.js",
21
+ "typings": "cjs/index.d.ts",
22
+ "files": [
23
+ "cjs",
24
+ "dist",
25
+ "esm",
26
+ "ts"
27
+ ],
28
+ "scripts": {
29
+ "build": "run-p build:cjs build:esm",
30
+ "build+dependency-check": "run-s build dependency-check",
31
+ "build:cjs": "tsc -p tsconfig.cjs.json",
32
+ "build:esm": "tsc -p tsconfig.esm.json",
33
+ "clean": "rimraf cjs esm lib libm",
34
+ "coverage": "jest --coverage",
35
+ "dependency-check": "run-p dependency-check:unused dependency-check:missing",
36
+ "dependency-check:unused": "dependency-check . --unused --no-dev",
37
+ "dependency-check:missing": "dependency-check . --missing --no-dev",
38
+ "lint": "eslint --ext=js,ts .",
39
+ "release": "npx semantic-release",
40
+ "size-limit": "size-limit",
41
+ "test": "jest",
42
+ "verify": "run-p build+dependency-check lint size-limit coverage",
43
+ "watch": "jest --watch"
58
44
  },
59
45
  "devDependencies": {
60
- "aurelia-logging": "^1.3.1",
61
- "aurelia-logging-color": "^0.5.5",
62
- "aurelia-polyfills": "^1.2.2",
63
- "ava": "^0.23.0",
64
- "awesome-typescript-loader": "^3.3.0",
65
- "browser-env": "^3.2.1",
66
- "colormap": "^2.3.0",
67
- "core-js": "^2.5.1",
68
- "dependency-check": "^2.9.1",
69
- "eslint": "^4.10.0",
70
- "eslint-config-unional": "^0.2.3",
71
- "nyc": "^11.3.0",
46
+ "@babel/core": "^7.16.0",
47
+ "@babel/plugin-proposal-class-properties": "^7.16.0",
48
+ "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.0",
49
+ "@babel/plugin-proposal-optional-chaining": "^7.16.0",
50
+ "@babel/preset-env": "^7.16.4",
51
+ "@babel/preset-typescript": "^7.16.0",
52
+ "@commitlint/cli": "^16.0.0",
53
+ "@commitlint/config-conventional": "^16.0.0",
54
+ "@size-limit/preset-small-lib": "^7.0.5",
55
+ "@types/jest": "^27.4.0",
56
+ "assertron": "^7.0.2",
57
+ "colormap": "^2.3.1",
58
+ "dependency-check": "^4.1.0",
59
+ "eslint": "^8.6.0",
60
+ "eslint-plugin-harmony": "^6.0.0",
61
+ "husky": "^7.0.4",
62
+ "jest": "^27.4.5",
63
+ "jest-junit": "^13.0.0",
64
+ "jest-progress-tracker": "^3.0.1",
65
+ "jest-validate": "^27.4.2",
66
+ "jest-watch-repeat": "^2.0.0",
67
+ "jest-watch-suspend": "^1.1.2",
68
+ "jest-watch-toggle-config": "^2.0.1",
69
+ "jest-watch-typeahead": "^1.0.0",
70
+ "npm-run-all": "^4.1.5",
72
71
  "param-case": "^2.1.1",
73
72
  "pascal-case": "^2.0.1",
74
- "rimraf": "^2.6.2",
75
- "rollup": "^0.50.0",
76
- "rollup-plugin-commonjs": "^8.2.6",
77
- "rollup-plugin-node-builtins": "^2.1.2",
78
- "rollup-plugin-node-globals": "^1.1.0",
79
- "rollup-plugin-node-resolve": "^3.0.0",
80
- "rollup-plugin-sourcemaps": "^0.4.2",
81
- "source-map-loader": "^0.2.3",
82
- "ts-loader": "^3.1.1",
83
- "tslint": "^5.8.0",
84
- "tslint-config-unional": "^0.8.0",
85
- "typescript": "^2.6.1",
86
- "uglifyjs-webpack-plugin": "^1.0.1",
87
- "webpack": "^3.8.1"
88
- }
73
+ "rimraf": "^3.0.2",
74
+ "size-limit": "^7.0.5",
75
+ "ts-loader": "^5.0.0",
76
+ "typescript": "^4.5.4",
77
+ "webpack": "^4.31.0",
78
+ "webpack-cli": "^3.3.2"
79
+ },
80
+ "size-limit": [
81
+ {
82
+ "limit": "2 KB"
83
+ }
84
+ ]
89
85
  }
@@ -0,0 +1,176 @@
1
+ import t from 'assert';
2
+ import { createColors } from '.';
3
+
4
+ test('match colormap output', () => {
5
+ const actual = createColors([0, 0, 255], [0, 255, 128], 72)
6
+
7
+ expect(actual).toEqual([
8
+ [0, 0, 255, 1],
9
+ [0, 4, 253, 1],
10
+ [0, 7, 251, 1],
11
+ [0, 11, 250, 1],
12
+ [0, 14, 248, 1],
13
+ [0, 18, 246, 1],
14
+ [0, 22, 244, 1],
15
+ [0, 25, 242, 1],
16
+ [0, 29, 241, 1],
17
+ [0, 32, 239, 1],
18
+ [0, 36, 237, 1],
19
+ [0, 40, 235, 1],
20
+ [0, 43, 234, 1],
21
+ [0, 47, 232, 1],
22
+ [0, 50, 230, 1],
23
+ [0, 54, 228, 1],
24
+ [0, 57, 226, 1],
25
+ [0, 61, 225, 1],
26
+ [0, 65, 223, 1],
27
+ [0, 68, 221, 1],
28
+ [0, 72, 219, 1],
29
+ [0, 75, 217, 1],
30
+ [0, 79, 216, 1],
31
+ [0, 83, 214, 1],
32
+ [0, 86, 212, 1],
33
+ [0, 90, 210, 1],
34
+ [0, 93, 208, 1],
35
+ [0, 97, 207, 1],
36
+ [0, 101, 205, 1],
37
+ [0, 104, 203, 1],
38
+ [0, 108, 201, 1],
39
+ [0, 111, 200, 1],
40
+ [0, 115, 198, 1],
41
+ [0, 119, 196, 1],
42
+ [0, 122, 194, 1],
43
+ [0, 126, 192, 1],
44
+ [0, 129, 191, 1],
45
+ [0, 133, 189, 1],
46
+ [0, 136, 187, 1],
47
+ [0, 140, 185, 1],
48
+ [0, 144, 183, 1],
49
+ [0, 147, 182, 1],
50
+ [0, 151, 180, 1],
51
+ [0, 154, 178, 1],
52
+ [0, 158, 176, 1],
53
+ [0, 162, 175, 1],
54
+ [0, 165, 173, 1],
55
+ [0, 169, 171, 1],
56
+ [0, 172, 169, 1],
57
+ [0, 176, 167, 1],
58
+ [0, 180, 166, 1],
59
+ [0, 183, 164, 1],
60
+ [0, 187, 162, 1],
61
+ [0, 190, 160, 1],
62
+ [0, 194, 158, 1],
63
+ [0, 198, 157, 1],
64
+ [0, 201, 155, 1],
65
+ [0, 205, 153, 1],
66
+ [0, 208, 151, 1],
67
+ [0, 212, 149, 1],
68
+ [0, 215, 148, 1],
69
+ [0, 219, 146, 1],
70
+ [0, 223, 144, 1],
71
+ [0, 226, 142, 1],
72
+ [0, 230, 141, 1],
73
+ [0, 233, 139, 1],
74
+ [0, 237, 137, 1],
75
+ [0, 241, 135, 1],
76
+ [0, 244, 133, 1],
77
+ [0, 248, 132, 1],
78
+ [0, 251, 130, 1],
79
+ [0, 255, 128, 1]])
80
+ })
81
+
82
+ test('Uses alpha in from/to', () => {
83
+ const actual = createColors([0, 0, 0, .2], [1, 1, 1, .8], 2)
84
+ expect(actual).toEqual([[0, 0, 0, .2], [1, 1, 1, .8]])
85
+ })
86
+
87
+ test('alpha in from but not in to, will use alpha in from', () => {
88
+ const actual = createColors([0, 0, 0, .2], [1, 1, 1], 2)
89
+ expect(actual).toEqual([[0, 0, 0, .2], [1, 1, 1, .2]])
90
+ })
91
+
92
+ test('alpha in `to` but not in `from`, will use alpha in `to`', () => {
93
+ const actual = createColors([0, 0, 0], [1, 1, 1, .5], 2)
94
+ expect(actual).toEqual([[0, 0, 0, .5], [1, 1, 1, .5]])
95
+ })
96
+
97
+
98
+ test('match actual colors', () => {
99
+ let actual = createColors([150, 0, 90], [0, 0, 200], 72, [0, 1])
100
+
101
+ t.deepStrictEqual(actual, [
102
+ [150, 0, 90, 0],
103
+ [148, 0, 92, 0.014084507042253521],
104
+ [146, 0, 93, 0.028169014084507043],
105
+ [144, 0, 95, 0.04225352112676056],
106
+ [142, 0, 96, 0.056338028169014086],
107
+ [139, 0, 98, 0.07042253521126761],
108
+ [137, 0, 99, 0.08450704225352113],
109
+ [135, 0, 101, 0.09859154929577466],
110
+ [133, 0, 102, 0.11267605633802817],
111
+ [131, 0, 104, 0.1267605633802817],
112
+ [129, 0, 105, 0.14084507042253522],
113
+ [127, 0, 107, 0.15492957746478875],
114
+ [125, 0, 109, 0.16901408450704225],
115
+ [123, 0, 110, 0.18309859154929578],
116
+ [120, 0, 112, 0.1971830985915493],
117
+ [118, 0, 113, 0.2112676056338028],
118
+ [116, 0, 115, 0.22535211267605634],
119
+ [114, 0, 116, 0.23943661971830987],
120
+ [112, 0, 118, 0.2535211267605634],
121
+ [110, 0, 119, 0.26760563380281693],
122
+ [108, 0, 121, 0.28169014084507044],
123
+ [106, 0, 123, 0.29577464788732394],
124
+ [104, 0, 124, 0.3098591549295775],
125
+ [101, 0, 126, 0.323943661971831],
126
+ [99, 0, 127, 0.3380281690140845],
127
+ [97, 0, 129, 0.35211267605633806],
128
+ [95, 0, 130, 0.36619718309859156],
129
+ [93, 0, 132, 0.38028169014084506],
130
+ [91, 0, 133, 0.3943661971830986],
131
+ [89, 0, 135, 0.4084507042253521],
132
+ [87, 0, 136, 0.4225352112676056],
133
+ [85, 0, 138, 0.4366197183098592],
134
+ [82, 0, 140, 0.4507042253521127],
135
+ [80, 0, 141, 0.4647887323943662],
136
+ [78, 0, 143, 0.47887323943661975],
137
+ [76, 0, 144, 0.49295774647887325],
138
+ [74, 0, 146, 0.5070422535211268],
139
+ [72, 0, 147, 0.5211267605633803],
140
+ [70, 0, 149, 0.5352112676056339],
141
+ [68, 0, 150, 0.5492957746478874],
142
+ [65, 0, 152, 0.5633802816901409],
143
+ [63, 0, 154, 0.5774647887323944],
144
+ [61, 0, 155, 0.5915492957746479],
145
+ [59, 0, 157, 0.6056338028169014],
146
+ [57, 0, 158, 0.619718309859155],
147
+ [55, 0, 160, 0.6338028169014085],
148
+ [53, 0, 161, 0.647887323943662],
149
+ [51, 0, 163, 0.6619718309859155],
150
+ [49, 0, 164, 0.676056338028169],
151
+ [46, 0, 166, 0.6901408450704225],
152
+ [44, 0, 167, 0.7042253521126761],
153
+ [42, 0, 169, 0.7183098591549296],
154
+ [40, 0, 171, 0.7323943661971831],
155
+ [38, 0, 172, 0.7464788732394366],
156
+ [36, 0, 174, 0.7605633802816901],
157
+ [34, 0, 175, 0.7746478873239436],
158
+ [32, 0, 177, 0.7887323943661972],
159
+ [30, 0, 178, 0.8028169014084507],
160
+ [27, 0, 180, 0.8169014084507042],
161
+ [25, 0, 181, 0.8309859154929577],
162
+ [23, 0, 183, 0.8450704225352113],
163
+ [21, 0, 185, 0.8591549295774648],
164
+ [19, 0, 186, 0.8732394366197184],
165
+ [17, 0, 188, 0.8873239436619719],
166
+ [15, 0, 189, 0.9014084507042254],
167
+ [13, 0, 191, 0.9154929577464789],
168
+ [11, 0, 192, 0.9295774647887324],
169
+ [8, 0, 194, 0.943661971830986],
170
+ [6, 0, 195, 0.9577464788732395],
171
+ [4, 0, 197, 0.971830985915493],
172
+ [2, 0, 198, 0.9859154929577465],
173
+ [0, 0, 200, 1]])
174
+ actual = createColors([150, 0, 90], [0, 0, 200], 72)
175
+ expect(actual).toEqual([[150, 0, 90, 1], [148, 0, 92, 1], [146, 0, 93, 1], [144, 0, 95, 1], [142, 0, 96, 1], [139, 0, 98, 1], [137, 0, 99, 1], [135, 0, 101, 1], [133, 0, 102, 1], [131, 0, 104, 1], [129, 0, 105, 1], [127, 0, 107, 1], [125, 0, 109, 1], [123, 0, 110, 1], [120, 0, 112, 1], [118, 0, 113, 1], [116, 0, 115, 1], [114, 0, 116, 1], [112, 0, 118, 1], [110, 0, 119, 1], [108, 0, 121, 1], [106, 0, 123, 1], [104, 0, 124, 1], [101, 0, 126, 1], [99, 0, 127, 1], [97, 0, 129, 1], [95, 0, 130, 1], [93, 0, 132, 1], [91, 0, 133, 1], [89, 0, 135, 1], [87, 0, 136, 1], [85, 0, 138, 1], [82, 0, 140, 1], [80, 0, 141, 1], [78, 0, 143, 1], [76, 0, 144, 1], [74, 0, 146, 1], [72, 0, 147, 1], [70, 0, 149, 1], [68, 0, 150, 1], [65, 0, 152, 1], [63, 0, 154, 1], [61, 0, 155, 1], [59, 0, 157, 1], [57, 0, 158, 1], [55, 0, 160, 1], [53, 0, 161, 1], [51, 0, 163, 1], [49, 0, 164, 1], [46, 0, 166, 1], [44, 0, 167, 1], [42, 0, 169, 1], [40, 0, 171, 1], [38, 0, 172, 1], [36, 0, 174, 1], [34, 0, 175, 1], [32, 0, 177, 1], [30, 0, 178, 1], [27, 0, 180, 1], [25, 0, 181, 1], [23, 0, 183, 1], [21, 0, 185, 1], [19, 0, 186, 1], [17, 0, 188, 1], [15, 0, 189, 1], [13, 0, 191, 1], [11, 0, 192, 1], [8, 0, 194, 1], [6, 0, 195, 1], [4, 0, 197, 1], [2, 0, 198, 1], [0, 0, 200, 1]])
176
+ })
@@ -0,0 +1,35 @@
1
+ import { RGB, RGBA, Alpha } from './interfaces'
2
+
3
+ export function createColors(
4
+ from: RGB | RGBA,
5
+ to: RGB | RGBA,
6
+ shades: number,
7
+ alpha: Alpha = [
8
+ from.length === 4 ? from[3] : to.length === 4 ? to[3] : 1,
9
+ to.length === 4 ? to[3] : from.length === 4 ? from[3] : 1
10
+ ]): RGBA[] {
11
+ const start = [...from]
12
+ const diff = [
13
+ to[0] - from[0],
14
+ to[1] - from[1],
15
+ to[2] - from[2],
16
+ alpha[1] - alpha[0]
17
+ ]
18
+
19
+ if (start.length === 3)
20
+ start.push(alpha[0])
21
+
22
+ const inc = 1 / Math.max(shades - 1, 1)
23
+
24
+ const rgba: any[] = []
25
+ for (let i = 0; i < shades; i++) {
26
+ const color = [
27
+ Math.round(start[0] + i * diff[0] * inc),
28
+ Math.round(start[1] + i * diff[1] * inc),
29
+ Math.round(start[2] + i * diff[2] * inc),
30
+ start[3] + i * diff[3] * inc
31
+ ]
32
+ rgba.push(color)
33
+ }
34
+ return rgba
35
+ }
@@ -0,0 +1,11 @@
1
+ import a from 'assertron';
2
+ import { ColorMap, createColorsFromMap } from '.';
3
+
4
+ test('summer colors', () => {
5
+ const summer: ColorMap = [{ index: 0, rgb: [0, 128, 102] }, { index: 1, rgb: [255, 255, 102] }]
6
+
7
+ a.throws(() => createColorsFromMap(summer, 1))
8
+
9
+ const actual = createColorsFromMap(summer, 60)
10
+ expect(actual).toEqual([[0, 128, 102, 1], [4, 130, 102, 1], [9, 132, 102, 1], [13, 134, 102, 1], [17, 137, 102, 1], [22, 139, 102, 1], [26, 141, 102, 1], [30, 143, 102, 1], [35, 145, 102, 1], [39, 147, 102, 1], [43, 150, 102, 1], [48, 152, 102, 1], [52, 154, 102, 1], [56, 156, 102, 1], [61, 158, 102, 1], [65, 160, 102, 1], [69, 162, 102, 1], [73, 165, 102, 1], [78, 167, 102, 1], [82, 169, 102, 1], [86, 171, 102, 1], [91, 173, 102, 1], [95, 175, 102, 1], [99, 178, 102, 1], [104, 180, 102, 1], [108, 182, 102, 1], [112, 184, 102, 1], [117, 186, 102, 1], [121, 188, 102, 1], [125, 190, 102, 1], [130, 193, 102, 1], [134, 195, 102, 1], [138, 197, 102, 1], [143, 199, 102, 1], [147, 201, 102, 1], [151, 203, 102, 1], [156, 205, 102, 1], [160, 208, 102, 1], [164, 210, 102, 1], [169, 212, 102, 1], [173, 214, 102, 1], [177, 216, 102, 1], [182, 218, 102, 1], [186, 221, 102, 1], [190, 223, 102, 1], [194, 225, 102, 1], [199, 227, 102, 1], [203, 229, 102, 1], [207, 231, 102, 1], [212, 233, 102, 1], [216, 236, 102, 1], [220, 238, 102, 1], [225, 240, 102, 1], [229, 242, 102, 1], [233, 244, 102, 1], [238, 246, 102, 1], [242, 249, 102, 1], [246, 251, 102, 1], [251, 253, 102, 1], [255, 255, 102, 1]])
11
+ })
@@ -0,0 +1,26 @@
1
+ import { createColors } from './createColors'
2
+ import { ColorMap, Alpha, RGBA } from './interfaces'
3
+
4
+ /**
5
+ * Create colors with specified color map.
6
+ */
7
+ export function createColorsFromMap(colormap: ColorMap, shades: number, alpha?: Alpha): RGBA[] {
8
+ if (shades < colormap.length) {
9
+ throw new Error(`Requires at least ${colormap.length} shades.`)
10
+ }
11
+
12
+ const result: RGBA[] = []
13
+ const steps: number[] = []
14
+ for (let i = 0; i < colormap.length; i++) {
15
+ steps.push(Math.round(colormap[i].index * shades))
16
+ }
17
+
18
+ for (let i = 0; i < colormap.length - 1; i++) {
19
+ const n = steps[i + 1] - steps[i]
20
+ const from = colormap[i].rgb;
21
+ const to = colormap[i + 1].rgb;
22
+ result.push(...createColors(from, to, n, alpha))
23
+ }
24
+
25
+ return result
26
+ }
package/ts/index.ts ADDED
@@ -0,0 +1,5 @@
1
+ export * from './createColors'
2
+ export * from './createColorsFromMap'
3
+ export * from './interfaces'
4
+ export * from './rgbHex'
5
+ export * from './rgbaString'
@@ -0,0 +1,15 @@
1
+ export type RGB = [number, number, number]
2
+ export type RGBA = [number, number, number, number]
3
+ export type Alpha = [number, number]
4
+
5
+ export type ColorMap = {
6
+ /**
7
+ * Defines how fast or slow the `rgb` values will change from one segment to the next.
8
+ * i.e. the steepness of the gradient between two segments.
9
+ */
10
+ index: number,
11
+ /**
12
+ * RGB or RGBA. if RGBA, this alpha will be used instead of the alpha specified in the call.
13
+ */
14
+ rgb: RGB | RGBA
15
+ }[]
@@ -0,0 +1,17 @@
1
+ import { rgbHex } from '.'
2
+
3
+ test('[0,0,0] => #000000', () => {
4
+ expect(rgbHex([0, 0, 0])).toBe('#000000')
5
+ })
6
+
7
+ test('[255,128,16] => #ff8010', () => {
8
+ expect(rgbHex([255, 128, 16])).toBe('#ff8010')
9
+ })
10
+
11
+ test('[255,128,16,0] => #ff8010', () => {
12
+ expect(rgbHex([255, 128, 16, 0])).toBe('#ff8010')
13
+ })
14
+
15
+ test('[255,128,16,0.8] => #ff8010', () => {
16
+ expect(rgbHex([255, 128, 16, 0.8])).toBe('#ff8010')
17
+ })
package/ts/rgbHex.ts ADDED
@@ -0,0 +1,18 @@
1
+ import { RGB, RGBA } from './interfaces'
2
+
3
+ /**
4
+ * Convert `RGB` to `#rgb`
5
+ * JavaScript note: no check for array length, use it properly.
6
+ */
7
+ export function rgbHex(rgb: RGB | RGBA) {
8
+ let hex = '#'
9
+ for (let i = 0; i < 3; i++) {
10
+ hex += d2h(rgb[i])
11
+ }
12
+ return hex
13
+ }
14
+
15
+ function d2h(d: number) {
16
+ const s = (+d).toString(16)
17
+ return s.length < 2 ? '0' + s : s
18
+ }
@@ -0,0 +1,9 @@
1
+ import { rgbaString } from '.';
2
+
3
+ test('[255,128,16,0] => rgba(255,128,16,0)', () => {
4
+ expect(rgbaString([255, 128, 16, 0])).toBe('rgba(255,128,16,0)')
5
+ })
6
+
7
+ test('[255,128,16,0.3] => rgba(255,128,16,0.3)', () => {
8
+ expect(rgbaString([255, 128, 16, 0.3])).toBe('rgba(255,128,16,0.3)')
9
+ })
@@ -0,0 +1,5 @@
1
+ import { RGBA } from './interfaces'
2
+
3
+ export function rgbaString(rgba: RGBA) {
4
+ return 'rgba(' + rgba.join(',') + ')';
5
+ }
@@ -1 +0,0 @@
1
- {"version":3,"sources":[null,"webpack:///color-map/createColors.ts","webpack:///color-map/index.ts","webpack:///color-map/createColorsFromMap.ts","webpack:///color-map/rgbHex.ts","webpack:///color-map/rgbaString.ts"],"names":["__webpack_require__","moduleId","installedModules","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","createColors","from","to","shades","alpha","rgba","start","slice","diff","push","inc","Math","max","color","round","__export","createColors_1","createColorsFromMap","colormap","length","Error","result","steps","index","rgb","apply","d2h","toString","rgbHex","hex","rgbaString","join"],"mappings":"yBAIA,SAAAA,EAAAC,GAGA,GAAAC,EAAAD,GACA,OAAAC,EAAAD,GAAAE,QAGA,IAAAC,EAAAF,EAAAD,IACAI,EAAAJ,EACAK,GAAA,EACAH,YAUA,OANAI,EAAAN,GAAAO,KAAAJ,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,GAAA,EAGAF,EAAAD,QAvBA,IAAAD,KA4DA,OAhCAF,EAAAS,EAAAF,EAGAP,EAAAU,EAAAR,EAGAF,EAAAW,EAAA,SAAAR,EAAAS,EAAAC,GACAb,EAAAc,EAAAX,EAAAS,IACAG,OAAAC,eAAAb,EAAAS,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAb,EAAAoB,EAAA,SAAAhB,GACA,IAAAS,EAAAT,KAAAiB,WACA,WAA2B,OAAAjB,EAAA,SAC3B,WAAiC,OAAAA,GAEjC,OADAJ,EAAAW,EAAAE,EAAA,IAAAA,GACAA,GAIAb,EAAAc,EAAA,SAAAQ,EAAAC,GAAsD,OAAAR,OAAAS,UAAAC,eAAAjB,KAAAc,EAAAC,IAGtDvB,EAAA0B,EAAA,GAGA1B,IAAA2B,EAAA,mFC3DAxB,EAAAyB,aAAA,SAA6BC,EAAWC,EAASC,EAAgBC,QAAA,IAAAA,OAAgB,EAAG,IAClF,IAAMC,KACAC,EAAYL,EAAIM,QAChBC,GACJN,EAAG,GAAKD,EAAK,GACbC,EAAG,GAAKD,EAAK,GACbC,EAAG,GAAKD,EAAK,IAGfK,EAAMG,KAAKL,EAAM,IACjBI,EAAKC,KAAKL,EAAM,GAAKA,EAAM,IAK3B,IAAK,IAHCM,EAAM,EACVC,KAAKC,IAAIT,EAAS,EAAG,GAEd1B,EAAI,EAAGA,EAAI0B,EAAQ1B,IAAK,CAC/B,IAAMoC,GACJF,KAAKG,MAAMR,EAAM,GAAK7B,EAAI+B,EAAK,GAAKE,GACpCC,KAAKG,MAAMR,EAAM,GAAK7B,EAAI+B,EAAK,GAAKE,GACpCC,KAAKG,MAAMR,EAAM,GAAK7B,EAAI+B,EAAK,GAAKE,GACpCJ,EAAM,GAAK7B,EAAI+B,EAAK,GAAKE,GAE3BL,EAAKI,KAAKI,GAEZ,OAAOR,gJC1BTU,EAAA3C,EAAA,IACA2C,EAAA3C,EAAA,IAEA2C,EAAA3C,EAAA,IACA2C,EAAA3C,EAAA,mFCHA,IAAA4C,EAAA5C,EAAA,GAKAG,EAAA0C,oBAAA,SAAoCC,EAAoBf,EAAgBC,GACtE,GAAID,EAASe,EAASC,OACpB,MAAM,IAAIC,MAAM,qBAAqBF,EAASC,OAAM,YAKtD,IAAK,IAFCE,KACAC,KACG7C,EAAI,EAAGA,EAAIyC,EAASC,OAAQ1C,IACnC6C,EAAMb,KAAKE,KAAKG,MAAMI,EAASzC,GAAG8C,MAAQpB,IAG5C,IAAS1B,EAAI,EAAGA,EAAIyC,EAASC,OAAS,EAAG1C,IAAK,CAC5C,IAAMe,EAAI8B,EAAM7C,EAAI,GAAK6C,EAAM7C,GACzBwB,EAAYiB,EAASzC,GAAG+C,IACxBtB,EAAKgB,EAASzC,EAAI,GAAG+C,IAC3BH,EAAOZ,KAAIgB,MAAXJ,EAAeL,EAAAhB,aAAaC,EAAMC,EAAIV,EAAGY,IAG3C,OAAOiB,iCCVT,SAAAK,EAAa3C,GACX,IAAIgB,IAAMhB,GAAG4C,SAAS,IACtB,OAAO5B,EAAEoB,OAAS,EAAI,IAAMpB,EAAIA,mDAVlCxB,EAAAqD,OAAA,SAAuBJ,GAErB,IAAK,IADDK,EAAM,IACDpD,EAAI,EAAGA,EAAI,EAAGA,IACrBoD,GAAOH,EAAIF,EAAI/C,IAEjB,OAAOoD,kFCTTtD,EAAAuD,WAAA,SAA2BzB,GACzB,MAAO,QAAUA,EAAK0B,KAAK,KAAO","file":"color-map.es5.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 87a5678e5e7a6f44f53e","import { RGB, RGBA, Alpha } from './interfaces'\n\nexport function createColors(from: RGB, to: RGB, shades: number, alpha: Alpha = [1, 1]): RGBA[] {\n const rgba: any[] = []\n const start = [...from]\n const diff = [\n to[0] - from[0],\n to[1] - from[1],\n to[2] - from[2]\n ]\n\n start.push(alpha[0])\n diff.push(alpha[1] - alpha[0])\n\n const inc = 1 /\n Math.max(shades - 1, 1)\n\n for (let i = 0; i < shades; i++) {\n const color = [\n Math.round(start[0] + i * diff[0] * inc),\n Math.round(start[1] + i * diff[1] * inc),\n Math.round(start[2] + i * diff[2] * inc),\n start[3] + i * diff[3] * inc\n ]\n rgba.push(color)\n }\n return rgba\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/createColors.ts","export * from './createColors'\nexport * from './createColorsFromMap'\nexport * from './interfaces'\nexport * from './rgbHex'\nexport * from './rgbaString'\n\n\n\n// WEBPACK FOOTER //\n// ./src/index.ts","import { ColorMap, Alpha, RGBA, RGB } from './interfaces'\nimport { createColors } from './createColors'\n\n/**\n * Create colors with specified color map.\n */\nexport function createColorsFromMap(colormap: ColorMap, shades: number, alpha?: Alpha): RGBA[] {\n if (shades < colormap.length) {\n throw new Error(`Requires at least ${colormap.length} shades.`)\n }\n\n const result: RGBA[] = []\n const steps: number[] = []\n for (let i = 0; i < colormap.length; i++) {\n steps.push(Math.round(colormap[i].index * shades))\n }\n\n for (let i = 0; i < colormap.length - 1; i++) {\n const n = steps[i + 1] - steps[i]\n const from: RGB = colormap[i].rgb;\n const to = colormap[i + 1].rgb;\n result.push(...createColors(from, to, n, alpha))\n }\n\n return result\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/createColorsFromMap.ts","import { RGB } from './interfaces'\n\n/**\n * Convert `RGB` to `#rgb`\n * JavaScript note: no check for array length, use it properly.\n */\nexport function rgbHex(rgb: RGB) {\n let hex = '#'\n for (let i = 0; i < 3; i++) {\n hex += d2h(rgb[i])\n }\n return hex\n}\n\nfunction d2h(d: number) {\n let s = (+d).toString(16)\n return s.length < 2 ? '0' + s : s\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/rgbHex.ts","import { RGBA } from './interfaces'\n\nexport function rgbaString(rgba: RGBA) {\n return 'rgba(' + rgba.join(',') + ')';\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/rgbaString.ts"],"sourceRoot":""}
@@ -1,2 +0,0 @@
1
- import { RGB, RGBA, Alpha } from './interfaces';
2
- export declare function createColors(from: RGB, to: RGB, shades: number, alpha?: Alpha): RGBA[];
@@ -1,24 +0,0 @@
1
- export function createColors(from, to, shades, alpha = [1, 1]) {
2
- const rgba = [];
3
- const start = [...from];
4
- const diff = [
5
- to[0] - from[0],
6
- to[1] - from[1],
7
- to[2] - from[2]
8
- ];
9
- start.push(alpha[0]);
10
- diff.push(alpha[1] - alpha[0]);
11
- const inc = 1 /
12
- Math.max(shades - 1, 1);
13
- for (let i = 0; i < shades; i++) {
14
- const color = [
15
- Math.round(start[0] + i * diff[0] * inc),
16
- Math.round(start[1] + i * diff[1] * inc),
17
- Math.round(start[2] + i * diff[2] * inc),
18
- start[3] + i * diff[3] * inc
19
- ];
20
- rgba.push(color);
21
- }
22
- return rgba;
23
- }
24
- //# sourceMappingURL=createColors.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createColors.js","sourceRoot":"","sources":["../src/createColors.ts"],"names":[],"mappings":"AAEA,MAAM,uBAAuB,IAAS,EAAE,EAAO,EAAE,MAAc,EAAE,QAAe,CAAC,CAAC,EAAE,CAAC,CAAC;IACpF,MAAM,IAAI,GAAU,EAAE,CAAA;IACtB,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,CAAC,CAAA;IACvB,MAAM,IAAI,GAAG;QACX,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;QACf,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;QACf,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;KAChB,CAAA;IAED,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;IACpB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;IAE9B,MAAM,GAAG,GAAG,CAAC;QACX,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,CAAC,CAAA;IAEzB,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAChC,MAAM,KAAK,GAAG;YACZ,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;YACxC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;YACxC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;YACxC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG;SAC7B,CAAA;QACD,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAClB,CAAC;IACD,MAAM,CAAC,IAAI,CAAA;AACb,CAAC"}
@@ -1,5 +0,0 @@
1
- import { ColorMap, Alpha, RGBA } from './interfaces';
2
- /**
3
- * Create colors with specified color map.
4
- */
5
- export declare function createColorsFromMap(colormap: ColorMap, shades: number, alpha?: Alpha): RGBA[];
@@ -1,22 +0,0 @@
1
- import { createColors } from './createColors';
2
- /**
3
- * Create colors with specified color map.
4
- */
5
- export function createColorsFromMap(colormap, shades, alpha) {
6
- if (shades < colormap.length) {
7
- throw new Error(`Requires at least ${colormap.length} shades.`);
8
- }
9
- const result = [];
10
- const steps = [];
11
- for (let i = 0; i < colormap.length; i++) {
12
- steps.push(Math.round(colormap[i].index * shades));
13
- }
14
- for (let i = 0; i < colormap.length - 1; i++) {
15
- const n = steps[i + 1] - steps[i];
16
- const from = colormap[i].rgb;
17
- const to = colormap[i + 1].rgb;
18
- result.push(...createColors(from, to, n, alpha));
19
- }
20
- return result;
21
- }
22
- //# sourceMappingURL=createColorsFromMap.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createColorsFromMap.js","sourceRoot":"","sources":["../src/createColorsFromMap.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C;;GAEG;AACH,MAAM,8BAA8B,QAAkB,EAAE,MAAc,EAAE,KAAa;IACnF,EAAE,CAAC,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;QAC7B,MAAM,IAAI,KAAK,CAAC,qBAAqB,QAAQ,CAAC,MAAM,UAAU,CAAC,CAAA;IACjE,CAAC;IAED,MAAM,MAAM,GAAW,EAAE,CAAA;IACzB,MAAM,KAAK,GAAa,EAAE,CAAA;IAC1B,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACzC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC,CAAA;IACpD,CAAC;IAED,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC7C,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;QACjC,MAAM,IAAI,GAAQ,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;QAClC,MAAM,EAAE,GAAG,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;QAC/B,MAAM,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAA;IAClD,CAAC;IAED,MAAM,CAAC,MAAM,CAAA;AACf,CAAC"}
@@ -1,5 +0,0 @@
1
- export * from './createColors';
2
- export * from './createColorsFromMap';
3
- export * from './interfaces';
4
- export * from './rgbHex';
5
- export * from './rgbaString';
@@ -1,5 +0,0 @@
1
- export * from './createColors';
2
- export * from './createColorsFromMap';
3
- export * from './rgbHex';
4
- export * from './rgbaString';
5
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,uBAAuB,CAAA;AAErC,cAAc,UAAU,CAAA;AACxB,cAAc,cAAc,CAAA"}
@@ -1,14 +0,0 @@
1
- export declare type RGB = [number, number, number];
2
- export declare type RGBA = [number, number, number, number];
3
- export declare type Alpha = [number, number];
4
- export declare type ColorMap = {
5
- /**
6
- * Defines how fast or slow the `rgb` values will change from one segment to the next.
7
- * i.e. the steepness of the gradient between two segments.
8
- */
9
- index: number;
10
- /**
11
- * RGB or RGBA. if RGBA, this alpha will be used instead of the alpha specified in the call.
12
- */
13
- rgb: RGB | RGBA;
14
- }[];
@@ -1 +0,0 @@
1
- //# sourceMappingURL=interfaces.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":""}
@@ -1,6 +0,0 @@
1
- import { RGB } from './interfaces';
2
- /**
3
- * Convert `RGB` to `#rgb`
4
- * JavaScript note: no check for array length, use it properly.
5
- */
6
- export declare function rgbHex(rgb: RGB): string;
@@ -1,16 +0,0 @@
1
- /**
2
- * Convert `RGB` to `#rgb`
3
- * JavaScript note: no check for array length, use it properly.
4
- */
5
- export function rgbHex(rgb) {
6
- let hex = '#';
7
- for (let i = 0; i < 3; i++) {
8
- hex += d2h(rgb[i]);
9
- }
10
- return hex;
11
- }
12
- function d2h(d) {
13
- let s = (+d).toString(16);
14
- return s.length < 2 ? '0' + s : s;
15
- }
16
- //# sourceMappingURL=rgbHex.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rgbHex.js","sourceRoot":"","sources":["../src/rgbHex.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,iBAAiB,GAAQ;IAC7B,IAAI,GAAG,GAAG,GAAG,CAAA;IACb,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3B,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IACpB,CAAC;IACD,MAAM,CAAC,GAAG,CAAA;AACZ,CAAC;AAED,aAAa,CAAS;IACpB,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;IACzB,MAAM,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AACnC,CAAC"}
@@ -1,2 +0,0 @@
1
- import { RGBA } from './interfaces';
2
- export declare function rgbaString(rgba: RGBA): string;
@@ -1,4 +0,0 @@
1
- export function rgbaString(rgba) {
2
- return 'rgba(' + rgba.join(',') + ')';
3
- }
4
- //# sourceMappingURL=rgbaString.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rgbaString.js","sourceRoot":"","sources":["../src/rgbaString.ts"],"names":[],"mappings":"AAEA,MAAM,qBAAqB,IAAU;IACnC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;AACxC,CAAC"}
@@ -1,2 +0,0 @@
1
- import { RGB, RGBA, Alpha } from './interfaces';
2
- export declare function createColors(from: RGB, to: RGB, shades: number, alpha?: Alpha): RGBA[];
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- function createColors(from, to, shades, alpha) {
4
- if (alpha === void 0) { alpha = [1, 1]; }
5
- var rgba = [];
6
- var start = from.slice();
7
- var diff = [
8
- to[0] - from[0],
9
- to[1] - from[1],
10
- to[2] - from[2]
11
- ];
12
- start.push(alpha[0]);
13
- diff.push(alpha[1] - alpha[0]);
14
- var inc = 1 /
15
- Math.max(shades - 1, 1);
16
- for (var i = 0; i < shades; i++) {
17
- var color = [
18
- Math.round(start[0] + i * diff[0] * inc),
19
- Math.round(start[1] + i * diff[1] * inc),
20
- Math.round(start[2] + i * diff[2] * inc),
21
- start[3] + i * diff[3] * inc
22
- ];
23
- rgba.push(color);
24
- }
25
- return rgba;
26
- }
27
- exports.createColors = createColors;
28
- //# sourceMappingURL=createColors.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createColors.js","sourceRoot":"","sources":["../src/createColors.ts"],"names":[],"mappings":";;AAEA,sBAA6B,IAAS,EAAE,EAAO,EAAE,MAAc,EAAE,KAAqB;IAArB,sBAAA,EAAA,SAAgB,CAAC,EAAE,CAAC,CAAC;IACpF,IAAM,IAAI,GAAU,EAAE,CAAA;IACtB,IAAM,KAAK,GAAO,IAAI,QAAC,CAAA;IACvB,IAAM,IAAI,GAAG;QACX,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;QACf,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;QACf,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;KAChB,CAAA;IAED,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;IACpB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;IAE9B,IAAM,GAAG,GAAG,CAAC;QACX,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,CAAC,CAAA;IAEzB,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAChC,IAAM,KAAK,GAAG;YACZ,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;YACxC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;YACxC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;YACxC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG;SAC7B,CAAA;QACD,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAClB,CAAC;IACD,MAAM,CAAC,IAAI,CAAA;AACb,CAAC;AAzBD,oCAyBC"}
@@ -1,5 +0,0 @@
1
- import { ColorMap, Alpha, RGBA } from './interfaces';
2
- /**
3
- * Create colors with specified color map.
4
- */
5
- export declare function createColorsFromMap(colormap: ColorMap, shades: number, alpha?: Alpha): RGBA[];
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var createColors_1 = require("./createColors");
4
- /**
5
- * Create colors with specified color map.
6
- */
7
- function createColorsFromMap(colormap, shades, alpha) {
8
- if (shades < colormap.length) {
9
- throw new Error("Requires at least " + colormap.length + " shades.");
10
- }
11
- var result = [];
12
- var steps = [];
13
- for (var i = 0; i < colormap.length; i++) {
14
- steps.push(Math.round(colormap[i].index * shades));
15
- }
16
- for (var i = 0; i < colormap.length - 1; i++) {
17
- var n = steps[i + 1] - steps[i];
18
- var from = colormap[i].rgb;
19
- var to = colormap[i + 1].rgb;
20
- result.push.apply(result, createColors_1.createColors(from, to, n, alpha));
21
- }
22
- return result;
23
- }
24
- exports.createColorsFromMap = createColorsFromMap;
25
- //# sourceMappingURL=createColorsFromMap.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createColorsFromMap.js","sourceRoot":"","sources":["../src/createColorsFromMap.ts"],"names":[],"mappings":";;AACA,+CAA6C;AAE7C;;GAEG;AACH,6BAAoC,QAAkB,EAAE,MAAc,EAAE,KAAa;IACnF,EAAE,CAAC,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;QAC7B,MAAM,IAAI,KAAK,CAAC,uBAAqB,QAAQ,CAAC,MAAM,aAAU,CAAC,CAAA;IACjE,CAAC;IAED,IAAM,MAAM,GAAW,EAAE,CAAA;IACzB,IAAM,KAAK,GAAa,EAAE,CAAA;IAC1B,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACzC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC,CAAA;IACpD,CAAC;IAED,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC7C,IAAM,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;QACjC,IAAM,IAAI,GAAQ,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;QAClC,IAAM,EAAE,GAAG,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;QAC/B,MAAM,CAAC,IAAI,OAAX,MAAM,EAAS,2BAAY,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,CAAC,EAAC;IAClD,CAAC;IAED,MAAM,CAAC,MAAM,CAAA;AACf,CAAC;AAnBD,kDAmBC"}
@@ -1,5 +0,0 @@
1
- export * from './createColors';
2
- export * from './createColorsFromMap';
3
- export * from './interfaces';
4
- export * from './rgbHex';
5
- export * from './rgbaString';
package/dist-es5/index.js DELETED
@@ -1,10 +0,0 @@
1
- "use strict";
2
- function __export(m) {
3
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
4
- }
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- __export(require("./createColors"));
7
- __export(require("./createColorsFromMap"));
8
- __export(require("./rgbHex"));
9
- __export(require("./rgbaString"));
10
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,oCAA8B;AAC9B,2CAAqC;AAErC,8BAAwB;AACxB,kCAA4B"}
@@ -1,14 +0,0 @@
1
- export declare type RGB = [number, number, number];
2
- export declare type RGBA = [number, number, number, number];
3
- export declare type Alpha = [number, number];
4
- export declare type ColorMap = {
5
- /**
6
- * Defines how fast or slow the `rgb` values will change from one segment to the next.
7
- * i.e. the steepness of the gradient between two segments.
8
- */
9
- index: number;
10
- /**
11
- * RGB or RGBA. if RGBA, this alpha will be used instead of the alpha specified in the call.
12
- */
13
- rgb: RGB | RGBA;
14
- }[];
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=interfaces.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":""}
@@ -1,6 +0,0 @@
1
- import { RGB } from './interfaces';
2
- /**
3
- * Convert `RGB` to `#rgb`
4
- * JavaScript note: no check for array length, use it properly.
5
- */
6
- export declare function rgbHex(rgb: RGB): string;
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /**
4
- * Convert `RGB` to `#rgb`
5
- * JavaScript note: no check for array length, use it properly.
6
- */
7
- function rgbHex(rgb) {
8
- var hex = '#';
9
- for (var i = 0; i < 3; i++) {
10
- hex += d2h(rgb[i]);
11
- }
12
- return hex;
13
- }
14
- exports.rgbHex = rgbHex;
15
- function d2h(d) {
16
- var s = (+d).toString(16);
17
- return s.length < 2 ? '0' + s : s;
18
- }
19
- //# sourceMappingURL=rgbHex.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rgbHex.js","sourceRoot":"","sources":["../src/rgbHex.ts"],"names":[],"mappings":";;AAEA;;;GAGG;AACH,gBAAuB,GAAQ;IAC7B,IAAI,GAAG,GAAG,GAAG,CAAA;IACb,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3B,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IACpB,CAAC;IACD,MAAM,CAAC,GAAG,CAAA;AACZ,CAAC;AAND,wBAMC;AAED,aAAa,CAAS;IACpB,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;IACzB,MAAM,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AACnC,CAAC"}
@@ -1,2 +0,0 @@
1
- import { RGBA } from './interfaces';
2
- export declare function rgbaString(rgba: RGBA): string;
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- function rgbaString(rgba) {
4
- return 'rgba(' + rgba.join(',') + ')';
5
- }
6
- exports.rgbaString = rgbaString;
7
- //# sourceMappingURL=rgbaString.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rgbaString.js","sourceRoot":"","sources":["../src/rgbaString.ts"],"names":[],"mappings":";;AAEA,oBAA2B,IAAU;IACnC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;AACxC,CAAC;AAFD,gCAEC"}