Import upstream version 2.0.0
Debian Janitor
2 years ago
24 | 24 | If you use NPM, `npm install d3-scale-chromatic`. Otherwise, download the [latest release](https://github.com/d3/d3-scale-chromatic/releases/latest) or load directly from [d3js.org](https://d3js.org) as a [standalone library](https://d3js.org/d3-scale-chromatic.v1.min.js). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3` global is exported: |
25 | 25 | |
26 | 26 | ```html |
27 | <script src="https://d3js.org/d3-color.v1.min.js"></script> | |
28 | <script src="https://d3js.org/d3-interpolate.v1.min.js"></script> | |
29 | <script src="https://d3js.org/d3-scale-chromatic.v1.min.js"></script> | |
27 | <script src="https://d3js.org/d3-color.v2.min.js"></script> | |
28 | <script src="https://d3js.org/d3-interpolate.v2.min.js"></script> | |
29 | <script src="https://d3js.org/d3-scale-chromatic.v2.min.js"></script> | |
30 | 30 | <script> |
31 | 31 | |
32 | 32 | var yellow = d3.interpolateYlGn(0), // "rgb(255, 255, 229)" |
39 | 39 | Or, as part of the [D3 default bundle](https://github.com/d3/d3): |
40 | 40 | |
41 | 41 | ```html |
42 | <script src="https://d3js.org/d3.v5.min.js"></script> | |
42 | <script src="https://d3js.org/d3.v6.min.js"></script> | |
43 | 43 | <script> |
44 | 44 | |
45 | 45 | var yellow = d3.interpolateYlGn(0), // "rgb(255, 255, 229)" |
236 | 236 | |
237 | 237 | <img src="https://raw.githubusercontent.com/d3/d3-scale-chromatic/master/img/turbo.png" width="100%" height="40" alt="turbo"> |
238 | 238 | |
239 | Given a number *t* in the range [0,1], returns the corresponding color from the “turbo” color scheme by [Google AI](https://ai.googleblog.com/2019/08/turbo-improved-rainbow-colormap-for.html). | |
239 | Given a number *t* in the range [0,1], returns the corresponding color from the “turbo” color scheme by [Anton Mikhailov](https://ai.googleblog.com/2019/08/turbo-improved-rainbow-colormap-for.html). | |
240 | 240 | |
241 | 241 | <a name="interpolateViridis" href="#interpolateViridis">#</a> d3.<b>interpolateViridis</b>(<i>t</i>) [<>](https://github.com/d3/d3-scale-chromatic/blob/master/src/sequential-multi/viridis.js "Source") |
242 | 242 | |
284 | 284 | |
285 | 285 | <img src="https://raw.githubusercontent.com/d3/d3-scale-chromatic/master/img/cubehelix.png" width="100%" height="40" alt="cubehelix"> |
286 | 286 | |
287 | Given a number *t* in the range [0,1], returns the corresponding color from [Green’s default Cubehelix](https://www.mrao.cam.ac.uk/~dag/CUBEHELIX/) represented as an RGB string. | |
287 | Given a number *t* in the range [0,1], returns the corresponding color from [Green’s default Cubehelix](http://www.mrao.cam.ac.uk/~dag/CUBEHELIX/) represented as an RGB string. | |
288 | 288 | |
289 | 289 | <a href="#interpolateBuGn" name="interpolateBuGn">#</a> d3.<b>interpolateBuGn</b>(*t*) [<>](https://github.com/d3/d3-scale-chromatic/blob/master/src/sequential-multi/BuGn.js "Source") |
290 | 290 | <br><a href="#schemeBuGn" name="schemeBuGn">#</a> d3.<b>schemeBuGn</b>[*k*] |
0 | 0 | { |
1 | 1 | "name": "d3-scale-chromatic", |
2 | "version": "1.5.0", | |
2 | "version": "2.0.0", | |
3 | 3 | "description": "Sequential, diverging and categorical color schemes.", |
4 | 4 | "keywords": [ |
5 | 5 | "d3", |
35 | 35 | "postpublish": "git push && git push --tags && cd ../d3.github.com && git pull && cp ../${npm_package_name}/dist/${npm_package_name}.js ${npm_package_name}.v${npm_package_version%%.*}.js && cp ../${npm_package_name}/dist/${npm_package_name}.min.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git add ${npm_package_name}.v${npm_package_version%%.*}.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git commit -m \"${npm_package_name} ${npm_package_version}\" && git push && cd - && zip -j dist/${npm_package_name}.zip -- LICENSE README.md dist/${npm_package_name}.js dist/${npm_package_name}.min.js" |
36 | 36 | }, |
37 | 37 | "dependencies": { |
38 | "d3-color": "1", | |
39 | "d3-interpolate": "1" | |
38 | "d3-color": "1 - 2", | |
39 | "d3-interpolate": "1 - 2" | |
40 | 40 | }, |
41 | 41 | "devDependencies": { |
42 | 42 | "eslint": "6", |
0 | 0 | import {interpolateRgbBasis} from "d3-interpolate"; |
1 | 1 | |
2 | export default function(scheme) { | |
3 | return interpolateRgbBasis(scheme[scheme.length - 1]); | |
4 | } | |
2 | export default scheme => interpolateRgbBasis(scheme[scheme.length - 1]); |
0 | export default function(ranges) { | |
1 | ranges = ranges.map(function(colors) { | |
2 | return colors.match(/.{6}/g).map(function(x) { | |
3 | return "#" + x; | |
4 | }); | |
5 | }); | |
6 | var n0 = ranges[0].length; | |
7 | return function(n) { | |
8 | return ranges[n - n0]; | |
9 | }; | |
10 | } |
168 | 168 | shebang-command "^1.2.0" |
169 | 169 | which "^1.2.9" |
170 | 170 | |
171 | d3-color@1: | |
172 | version "1.3.0" | |
173 | resolved "https://registry.yarnpkg.com/d3-color/-/d3-color-1.3.0.tgz#675818359074215b020dc1d41d518136dcb18fa9" | |
174 | integrity sha512-NHODMBlj59xPAwl2BDiO2Mog6V+PrGRtBfWKqKRrs9MCqlSkIEb0Z/SfY7jW29ReHTDC/j+vwXhnZcXI3+3fbg== | |
175 | ||
176 | d3-interpolate@1: | |
177 | version "1.3.2" | |
178 | resolved "https://registry.yarnpkg.com/d3-interpolate/-/d3-interpolate-1.3.2.tgz#417d3ebdeb4bc4efcc8fd4361c55e4040211fd68" | |
179 | integrity sha512-NlNKGopqaz9qM1PXh9gBF1KSCVh+jSFErrSlD/4hybwoNX/gt1d8CDbDW+3i+5UOHhjC6s6nMvRxcuoMVNgL2w== | |
180 | dependencies: | |
181 | d3-color "1" | |
171 | "d3-color@1 - 2": | |
172 | version "2.0.0" | |
173 | resolved "https://registry.yarnpkg.com/d3-color/-/d3-color-2.0.0.tgz#8d625cab42ed9b8f601a1760a389f7ea9189d62e" | |
174 | integrity sha512-SPXi0TSKPD4g9tw0NMZFnR95XVgUZiBH+uUTqQuDu1OsE2zomHU7ho0FISciaPvosimixwHFl3WHLGabv6dDgQ== | |
175 | ||
176 | "d3-interpolate@1 - 2": | |
177 | version "2.0.1" | |
178 | resolved "https://registry.yarnpkg.com/d3-interpolate/-/d3-interpolate-2.0.1.tgz#98be499cfb8a3b94d4ff616900501a64abc91163" | |
179 | integrity sha512-c5UhwwTs/yybcmTpAVqwSFl6vrQ8JZJoT5F7xNFK9pymv5C0Ymcc9/LIJHtYIggg/yS9YHw8i8O8tgb9pupjeQ== | |
180 | dependencies: | |
181 | d3-color "1 - 2" | |
182 | 182 | |
183 | 183 | debug@^4.0.1: |
184 | 184 | version "4.1.1" |