projen-pipelines 0.2.2 → 0.2.4
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/.jsii +30 -15
- package/API.md +8 -8
- package/lib/awscdk/base.js +20 -8
- package/lib/awscdk/bash.js +1 -1
- package/lib/awscdk/github.d.ts +1 -0
- package/lib/awscdk/github.js +28 -2
- package/lib/awscdk/gitlab.js +1 -1
- package/lib/steps/artifact-steps.js +2 -2
- package/lib/steps/aws-assume-role.step.js +1 -1
- package/lib/steps/registries.js +2 -2
- package/lib/steps/step.js +4 -4
- package/node_modules/@babel/code-frame/lib/index.js +97 -37
- package/node_modules/@babel/code-frame/lib/index.js.map +1 -1
- package/node_modules/@babel/code-frame/package.json +3 -2
- package/node_modules/@babel/helper-validator-identifier/lib/identifier.js +4 -4
- package/node_modules/@babel/helper-validator-identifier/lib/identifier.js.map +1 -1
- package/node_modules/@babel/helper-validator-identifier/package.json +2 -2
- package/node_modules/ansi-styles/index.js +69 -67
- package/node_modules/ansi-styles/package.json +11 -11
- package/node_modules/ansi-styles/readme.md +14 -19
- package/node_modules/color-convert/conversions.js +310 -281
- package/node_modules/color-convert/index.js +24 -27
- package/node_modules/color-convert/package.json +5 -7
- package/node_modules/color-convert/route.js +22 -22
- package/node_modules/color-name/package.json +25 -28
- package/node_modules/escalade/index.d.mts +11 -0
- package/node_modules/escalade/index.d.ts +14 -2
- package/node_modules/escalade/package.json +18 -7
- package/node_modules/escalade/sync/index.d.mts +9 -0
- package/node_modules/escalade/sync/index.d.ts +13 -2
- package/node_modules/is-core-module/CHANGELOG.md +13 -0
- package/node_modules/is-core-module/core.json +1 -0
- package/node_modules/is-core-module/package.json +3 -3
- package/node_modules/is-core-module/test/index.js +3 -0
- package/node_modules/picocolors/LICENSE +1 -1
- package/node_modules/picocolors/package.json +2 -2
- package/node_modules/picocolors/picocolors.browser.js +1 -1
- package/node_modules/picocolors/picocolors.js +53 -43
- package/node_modules/picocolors/{types.ts → types.d.ts} +21 -0
- package/node_modules/resolve/lib/core.json +4 -0
- package/node_modules/resolve/package.json +12 -9
- package/node_modules/{get-pkg-repo → standard-version}/node_modules/through2/README.md +27 -21
- package/node_modules/standard-version/node_modules/through2/package.json +38 -0
- package/node_modules/standard-version/node_modules/through2/through2.js +83 -0
- package/node_modules/through2/README.md +21 -27
- package/node_modules/through2/package.json +11 -16
- package/node_modules/through2/through2.js +51 -38
- package/node_modules/uglify-js/lib/compress.js +23 -13
- package/node_modules/uglify-js/package.json +1 -1
- package/node_modules/wrap-ansi/node_modules/ansi-styles/index.js +163 -0
- package/node_modules/{@babel/highlight → wrap-ansi}/node_modules/ansi-styles/package.json +11 -11
- package/node_modules/{@babel/highlight → wrap-ansi}/node_modules/ansi-styles/readme.md +19 -14
- package/node_modules/{@babel/highlight → wrap-ansi}/node_modules/color-convert/conversions.js +281 -310
- package/node_modules/wrap-ansi/node_modules/color-convert/index.js +81 -0
- package/node_modules/{standard-version → wrap-ansi}/node_modules/color-convert/package.json +7 -5
- package/node_modules/{standard-version → wrap-ansi}/node_modules/color-convert/route.js +22 -22
- package/node_modules/{@babel/highlight → wrap-ansi}/node_modules/color-name/package.json +28 -25
- package/package.json +7 -7
- package/node_modules/@babel/helper-validator-identifier/scripts/generate-identifier-regex.js +0 -73
- package/node_modules/@babel/highlight/LICENSE +0 -22
- package/node_modules/@babel/highlight/README.md +0 -19
- package/node_modules/@babel/highlight/lib/index.js +0 -119
- package/node_modules/@babel/highlight/lib/index.js.map +0 -1
- package/node_modules/@babel/highlight/node_modules/ansi-styles/index.js +0 -165
- package/node_modules/@babel/highlight/node_modules/color-convert/index.js +0 -78
- package/node_modules/@babel/highlight/node_modules/color-convert/package.json +0 -46
- package/node_modules/@babel/highlight/node_modules/color-convert/route.js +0 -97
- package/node_modules/@babel/highlight/package.json +0 -30
- package/node_modules/figures/node_modules/escape-string-regexp/index.js +0 -11
- package/node_modules/figures/node_modules/escape-string-regexp/license +0 -21
- package/node_modules/figures/node_modules/escape-string-regexp/package.json +0 -41
- package/node_modules/figures/node_modules/escape-string-regexp/readme.md +0 -27
- package/node_modules/get-pkg-repo/node_modules/through2/package.json +0 -33
- package/node_modules/get-pkg-repo/node_modules/through2/through2.js +0 -96
- package/node_modules/standard-version/node_modules/ansi-styles/index.js +0 -165
- package/node_modules/standard-version/node_modules/ansi-styles/package.json +0 -56
- package/node_modules/standard-version/node_modules/ansi-styles/readme.md +0 -147
- package/node_modules/standard-version/node_modules/chalk/index.js +0 -228
- package/node_modules/standard-version/node_modules/chalk/index.js.flow +0 -93
- package/node_modules/standard-version/node_modules/chalk/license +0 -9
- package/node_modules/standard-version/node_modules/chalk/package.json +0 -71
- package/node_modules/standard-version/node_modules/chalk/readme.md +0 -314
- package/node_modules/standard-version/node_modules/chalk/templates.js +0 -128
- package/node_modules/standard-version/node_modules/chalk/types/index.d.ts +0 -97
- package/node_modules/standard-version/node_modules/color-convert/CHANGELOG.md +0 -54
- package/node_modules/standard-version/node_modules/color-convert/LICENSE +0 -21
- package/node_modules/standard-version/node_modules/color-convert/README.md +0 -68
- package/node_modules/standard-version/node_modules/color-convert/conversions.js +0 -868
- package/node_modules/standard-version/node_modules/color-convert/index.js +0 -78
- package/node_modules/standard-version/node_modules/color-name/.eslintrc.json +0 -43
- package/node_modules/standard-version/node_modules/color-name/.npmignore +0 -107
- package/node_modules/standard-version/node_modules/color-name/LICENSE +0 -8
- package/node_modules/standard-version/node_modules/color-name/README.md +0 -11
- package/node_modules/standard-version/node_modules/color-name/index.js +0 -152
- package/node_modules/standard-version/node_modules/color-name/package.json +0 -25
- package/node_modules/standard-version/node_modules/color-name/test.js +0 -7
- package/node_modules/standard-version/node_modules/detect-indent/license +0 -9
- package/node_modules/standard-version/node_modules/escape-string-regexp/index.js +0 -11
- package/node_modules/standard-version/node_modules/escape-string-regexp/license +0 -21
- package/node_modules/standard-version/node_modules/escape-string-regexp/package.json +0 -41
- package/node_modules/standard-version/node_modules/escape-string-regexp/readme.md +0 -27
- package/node_modules/standard-version/node_modules/has-flag/index.js +0 -8
- package/node_modules/standard-version/node_modules/has-flag/license +0 -9
- package/node_modules/standard-version/node_modules/has-flag/package.json +0 -44
- package/node_modules/standard-version/node_modules/has-flag/readme.md +0 -70
- package/node_modules/standard-version/node_modules/supports-color/browser.js +0 -5
- package/node_modules/standard-version/node_modules/supports-color/index.js +0 -131
- package/node_modules/standard-version/node_modules/supports-color/license +0 -9
- package/node_modules/standard-version/node_modules/supports-color/package.json +0 -53
- package/node_modules/standard-version/node_modules/supports-color/readme.md +0 -66
- /package/node_modules/{@babel/highlight/node_modules/chalk → chalk}/index.js +0 -0
- /package/node_modules/{@babel/highlight/node_modules/chalk → chalk}/index.js.flow +0 -0
- /package/node_modules/{@babel/highlight/node_modules/ansi-styles → chalk}/license +0 -0
- /package/node_modules/{@babel/highlight/node_modules/chalk → chalk}/package.json +0 -0
- /package/node_modules/{@babel/highlight/node_modules/chalk → chalk}/readme.md +0 -0
- /package/node_modules/{@babel/highlight/node_modules/chalk → chalk}/templates.js +0 -0
- /package/node_modules/{@babel/highlight/node_modules/chalk → chalk}/types/index.d.ts +0 -0
- /package/node_modules/{@babel/highlight/node_modules/color-name → color-name}/.eslintrc.json +0 -0
- /package/node_modules/{@babel/highlight/node_modules/color-name → color-name}/.npmignore +0 -0
- /package/node_modules/{@babel/highlight/node_modules/color-name → color-name}/test.js +0 -0
- /package/node_modules/{standard-version/node_modules/detect-indent → detect-indent}/index.d.ts +0 -0
- /package/node_modules/{standard-version/node_modules/detect-indent → detect-indent}/index.js +0 -0
- /package/node_modules/{@babel/highlight/node_modules/chalk → detect-indent}/license +0 -0
- /package/node_modules/{standard-version/node_modules/detect-indent → detect-indent}/package.json +0 -0
- /package/node_modules/{standard-version/node_modules/detect-indent → detect-indent}/readme.md +0 -0
- /package/node_modules/{@babel/highlight/node_modules/escape-string-regexp → escape-string-regexp}/index.js +0 -0
- /package/node_modules/{@babel/highlight/node_modules/escape-string-regexp → escape-string-regexp}/license +0 -0
- /package/node_modules/{@babel/highlight/node_modules/escape-string-regexp → escape-string-regexp}/package.json +0 -0
- /package/node_modules/{@babel/highlight/node_modules/escape-string-regexp → escape-string-regexp}/readme.md +0 -0
- /package/node_modules/{@babel/highlight/node_modules/has-flag → has-flag}/index.js +0 -0
- /package/node_modules/{@babel/highlight/node_modules/has-flag → has-flag}/license +0 -0
- /package/node_modules/{@babel/highlight/node_modules/has-flag → has-flag}/package.json +0 -0
- /package/node_modules/{@babel/highlight/node_modules/has-flag → has-flag}/readme.md +0 -0
- /package/node_modules/{conventional-changelog-writer/node_modules/semver → lru-cache}/LICENSE +0 -0
- /package/node_modules/{hosted-git-info/node_modules/lru-cache → lru-cache}/README.md +0 -0
- /package/node_modules/{hosted-git-info/node_modules/lru-cache → lru-cache}/index.js +0 -0
- /package/node_modules/{hosted-git-info/node_modules/lru-cache → lru-cache}/package.json +0 -0
- /package/node_modules/{conventional-changelog → standard-version/node_modules/conventional-changelog}/CHANGELOG.md +0 -0
- /package/node_modules/{conventional-changelog → standard-version/node_modules/conventional-changelog}/LICENSE.md +0 -0
- /package/node_modules/{conventional-changelog → standard-version/node_modules/conventional-changelog}/README.md +0 -0
- /package/node_modules/{conventional-changelog → standard-version/node_modules/conventional-changelog}/index.js +0 -0
- /package/node_modules/{conventional-changelog → standard-version/node_modules/conventional-changelog}/package.json +0 -0
- /package/node_modules/{conventional-changelog-angular → standard-version/node_modules/conventional-changelog-angular}/CHANGELOG.md +0 -0
- /package/node_modules/{conventional-changelog-angular → standard-version/node_modules/conventional-changelog-angular}/LICENSE.md +0 -0
- /package/node_modules/{conventional-changelog-angular → standard-version/node_modules/conventional-changelog-angular}/README.md +0 -0
- /package/node_modules/{conventional-changelog-angular → standard-version/node_modules/conventional-changelog-angular}/conventional-changelog.js +0 -0
- /package/node_modules/{conventional-changelog-angular → standard-version/node_modules/conventional-changelog-angular}/conventional-recommended-bump.js +0 -0
- /package/node_modules/{conventional-changelog-angular → standard-version/node_modules/conventional-changelog-angular}/index.js +0 -0
- /package/node_modules/{conventional-changelog-angular → standard-version/node_modules/conventional-changelog-angular}/package.json +0 -0
- /package/node_modules/{conventional-changelog-angular → standard-version/node_modules/conventional-changelog-angular}/parser-opts.js +0 -0
- /package/node_modules/{conventional-changelog-angular → standard-version/node_modules/conventional-changelog-angular}/templates/commit.hbs +0 -0
- /package/node_modules/{conventional-changelog-angular → standard-version/node_modules/conventional-changelog-angular}/templates/footer.hbs +0 -0
- /package/node_modules/{conventional-changelog-angular → standard-version/node_modules/conventional-changelog-angular}/templates/header.hbs +0 -0
- /package/node_modules/{conventional-changelog-angular → standard-version/node_modules/conventional-changelog-angular}/templates/template.hbs +0 -0
- /package/node_modules/{conventional-changelog-angular → standard-version/node_modules/conventional-changelog-angular}/writer-opts.js +0 -0
- /package/node_modules/{conventional-changelog-atom → standard-version/node_modules/conventional-changelog-atom}/CHANGELOG.md +0 -0
- /package/node_modules/{conventional-changelog-atom → standard-version/node_modules/conventional-changelog-atom}/LICENSE.md +0 -0
- /package/node_modules/{conventional-changelog-atom → standard-version/node_modules/conventional-changelog-atom}/README.md +0 -0
- /package/node_modules/{conventional-changelog-atom → standard-version/node_modules/conventional-changelog-atom}/conventional-changelog.js +0 -0
- /package/node_modules/{conventional-changelog-atom → standard-version/node_modules/conventional-changelog-atom}/conventional-recommended-bump.js +0 -0
- /package/node_modules/{conventional-changelog-atom → standard-version/node_modules/conventional-changelog-atom}/index.js +0 -0
- /package/node_modules/{conventional-changelog-atom → standard-version/node_modules/conventional-changelog-atom}/package.json +0 -0
- /package/node_modules/{conventional-changelog-atom → standard-version/node_modules/conventional-changelog-atom}/parser-opts.js +0 -0
- /package/node_modules/{conventional-changelog-atom → standard-version/node_modules/conventional-changelog-atom}/templates/commit.hbs +0 -0
- /package/node_modules/{conventional-changelog-atom → standard-version/node_modules/conventional-changelog-atom}/templates/header.hbs +0 -0
- /package/node_modules/{conventional-changelog-atom → standard-version/node_modules/conventional-changelog-atom}/templates/template.hbs +0 -0
- /package/node_modules/{conventional-changelog-atom → standard-version/node_modules/conventional-changelog-atom}/writer-opts.js +0 -0
- /package/node_modules/{conventional-changelog-codemirror → standard-version/node_modules/conventional-changelog-codemirror}/CHANGELOG.md +0 -0
- /package/node_modules/{conventional-changelog-codemirror → standard-version/node_modules/conventional-changelog-codemirror}/LICENSE.md +0 -0
- /package/node_modules/{conventional-changelog-codemirror → standard-version/node_modules/conventional-changelog-codemirror}/README.md +0 -0
- /package/node_modules/{conventional-changelog-codemirror → standard-version/node_modules/conventional-changelog-codemirror}/conventional-changelog.js +0 -0
- /package/node_modules/{conventional-changelog-codemirror → standard-version/node_modules/conventional-changelog-codemirror}/conventional-recommended-bump.js +0 -0
- /package/node_modules/{conventional-changelog-codemirror → standard-version/node_modules/conventional-changelog-codemirror}/index.js +0 -0
- /package/node_modules/{conventional-changelog-codemirror → standard-version/node_modules/conventional-changelog-codemirror}/package.json +0 -0
- /package/node_modules/{conventional-changelog-codemirror → standard-version/node_modules/conventional-changelog-codemirror}/parser-opts.js +0 -0
- /package/node_modules/{conventional-changelog-codemirror → standard-version/node_modules/conventional-changelog-codemirror}/templates/commit.hbs +0 -0
- /package/node_modules/{conventional-changelog-codemirror → standard-version/node_modules/conventional-changelog-codemirror}/templates/header.hbs +0 -0
- /package/node_modules/{conventional-changelog-codemirror → standard-version/node_modules/conventional-changelog-codemirror}/templates/template.hbs +0 -0
- /package/node_modules/{conventional-changelog-codemirror → standard-version/node_modules/conventional-changelog-codemirror}/writer-opts.js +0 -0
- /package/node_modules/{conventional-changelog-conventionalcommits → standard-version/node_modules/conventional-changelog-conventionalcommits}/CHANGELOG.md +0 -0
- /package/node_modules/{conventional-changelog-conventionalcommits → standard-version/node_modules/conventional-changelog-conventionalcommits}/LICENSE.md +0 -0
- /package/node_modules/{conventional-changelog-conventionalcommits → standard-version/node_modules/conventional-changelog-conventionalcommits}/README.md +0 -0
- /package/node_modules/{conventional-changelog-conventionalcommits → standard-version/node_modules/conventional-changelog-conventionalcommits}/add-bang-notes.js +0 -0
- /package/node_modules/{conventional-changelog-conventionalcommits → standard-version/node_modules/conventional-changelog-conventionalcommits}/conventional-changelog.js +0 -0
- /package/node_modules/{conventional-changelog-conventionalcommits → standard-version/node_modules/conventional-changelog-conventionalcommits}/conventional-recommended-bump.js +0 -0
- /package/node_modules/{conventional-changelog-conventionalcommits → standard-version/node_modules/conventional-changelog-conventionalcommits}/index.js +0 -0
- /package/node_modules/{conventional-changelog-conventionalcommits → standard-version/node_modules/conventional-changelog-conventionalcommits}/package.json +0 -0
- /package/node_modules/{conventional-changelog-conventionalcommits → standard-version/node_modules/conventional-changelog-conventionalcommits}/parser-opts.js +0 -0
- /package/node_modules/{conventional-changelog-conventionalcommits → standard-version/node_modules/conventional-changelog-conventionalcommits}/templates/commit.hbs +0 -0
- /package/node_modules/{conventional-changelog-conventionalcommits → standard-version/node_modules/conventional-changelog-conventionalcommits}/templates/footer.hbs +0 -0
- /package/node_modules/{conventional-changelog-conventionalcommits → standard-version/node_modules/conventional-changelog-conventionalcommits}/templates/header.hbs +0 -0
- /package/node_modules/{conventional-changelog-conventionalcommits → standard-version/node_modules/conventional-changelog-conventionalcommits}/templates/template.hbs +0 -0
- /package/node_modules/{conventional-changelog-conventionalcommits → standard-version/node_modules/conventional-changelog-conventionalcommits}/writer-opts.js +0 -0
- /package/node_modules/{conventional-changelog-core → standard-version/node_modules/conventional-changelog-core}/CHANGELOG.md +0 -0
- /package/node_modules/{conventional-changelog-core → standard-version/node_modules/conventional-changelog-core}/LICENSE.md +0 -0
- /package/node_modules/{conventional-changelog-core → standard-version/node_modules/conventional-changelog-core}/README.md +0 -0
- /package/node_modules/{conventional-changelog-core → standard-version/node_modules/conventional-changelog-core}/hosts/bitbucket.json +0 -0
- /package/node_modules/{conventional-changelog-core → standard-version/node_modules/conventional-changelog-core}/hosts/github.json +0 -0
- /package/node_modules/{conventional-changelog-core → standard-version/node_modules/conventional-changelog-core}/hosts/gitlab.json +0 -0
- /package/node_modules/{conventional-changelog-core → standard-version/node_modules/conventional-changelog-core}/index.js +0 -0
- /package/node_modules/{conventional-changelog-core → standard-version/node_modules/conventional-changelog-core}/lib/merge-config.js +0 -0
- /package/node_modules/{conventional-changelog-core → standard-version/node_modules/conventional-changelog-core}/package.json +0 -0
- /package/node_modules/{conventional-changelog-ember → standard-version/node_modules/conventional-changelog-ember}/CHANGELOG.md +0 -0
- /package/node_modules/{conventional-changelog-ember → standard-version/node_modules/conventional-changelog-ember}/LICENSE.md +0 -0
- /package/node_modules/{conventional-changelog-ember → standard-version/node_modules/conventional-changelog-ember}/README.md +0 -0
- /package/node_modules/{conventional-changelog-ember → standard-version/node_modules/conventional-changelog-ember}/conventional-changelog.js +0 -0
- /package/node_modules/{conventional-changelog-ember → standard-version/node_modules/conventional-changelog-ember}/conventional-recommended-bump.js +0 -0
- /package/node_modules/{conventional-changelog-ember → standard-version/node_modules/conventional-changelog-ember}/index.js +0 -0
- /package/node_modules/{conventional-changelog-ember → standard-version/node_modules/conventional-changelog-ember}/package.json +0 -0
- /package/node_modules/{conventional-changelog-ember → standard-version/node_modules/conventional-changelog-ember}/parser-opts.js +0 -0
- /package/node_modules/{conventional-changelog-ember → standard-version/node_modules/conventional-changelog-ember}/templates/commit.hbs +0 -0
- /package/node_modules/{conventional-changelog-ember → standard-version/node_modules/conventional-changelog-ember}/templates/header.hbs +0 -0
- /package/node_modules/{conventional-changelog-ember → standard-version/node_modules/conventional-changelog-ember}/templates/template.hbs +0 -0
- /package/node_modules/{conventional-changelog-ember → standard-version/node_modules/conventional-changelog-ember}/writer-opts.js +0 -0
- /package/node_modules/{conventional-changelog-eslint → standard-version/node_modules/conventional-changelog-eslint}/CHANGELOG.md +0 -0
- /package/node_modules/{conventional-changelog-eslint → standard-version/node_modules/conventional-changelog-eslint}/LICENSE.md +0 -0
- /package/node_modules/{conventional-changelog-eslint → standard-version/node_modules/conventional-changelog-eslint}/README.md +0 -0
- /package/node_modules/{conventional-changelog-eslint → standard-version/node_modules/conventional-changelog-eslint}/conventional-changelog.js +0 -0
- /package/node_modules/{conventional-changelog-eslint → standard-version/node_modules/conventional-changelog-eslint}/conventional-recommended-bump.js +0 -0
- /package/node_modules/{conventional-changelog-eslint → standard-version/node_modules/conventional-changelog-eslint}/index.js +0 -0
- /package/node_modules/{conventional-changelog-eslint → standard-version/node_modules/conventional-changelog-eslint}/package.json +0 -0
- /package/node_modules/{conventional-changelog-eslint → standard-version/node_modules/conventional-changelog-eslint}/parser-opts.js +0 -0
- /package/node_modules/{conventional-changelog-eslint → standard-version/node_modules/conventional-changelog-eslint}/templates/commit.hbs +0 -0
- /package/node_modules/{conventional-changelog-eslint → standard-version/node_modules/conventional-changelog-eslint}/templates/header.hbs +0 -0
- /package/node_modules/{conventional-changelog-eslint → standard-version/node_modules/conventional-changelog-eslint}/templates/template.hbs +0 -0
- /package/node_modules/{conventional-changelog-eslint → standard-version/node_modules/conventional-changelog-eslint}/writer-opts.js +0 -0
- /package/node_modules/{conventional-changelog-express → standard-version/node_modules/conventional-changelog-express}/CHANGELOG.md +0 -0
- /package/node_modules/{conventional-changelog-express → standard-version/node_modules/conventional-changelog-express}/LICENSE.md +0 -0
- /package/node_modules/{conventional-changelog-express → standard-version/node_modules/conventional-changelog-express}/README.md +0 -0
- /package/node_modules/{conventional-changelog-express → standard-version/node_modules/conventional-changelog-express}/conventional-changelog.js +0 -0
- /package/node_modules/{conventional-changelog-express → standard-version/node_modules/conventional-changelog-express}/conventional-recommended-bump.js +0 -0
- /package/node_modules/{conventional-changelog-express → standard-version/node_modules/conventional-changelog-express}/index.js +0 -0
- /package/node_modules/{conventional-changelog-express → standard-version/node_modules/conventional-changelog-express}/package.json +0 -0
- /package/node_modules/{conventional-changelog-express → standard-version/node_modules/conventional-changelog-express}/parser-opts.js +0 -0
- /package/node_modules/{conventional-changelog-express → standard-version/node_modules/conventional-changelog-express}/templates/commit.hbs +0 -0
- /package/node_modules/{conventional-changelog-express → standard-version/node_modules/conventional-changelog-express}/templates/header.hbs +0 -0
- /package/node_modules/{conventional-changelog-express → standard-version/node_modules/conventional-changelog-express}/templates/template.hbs +0 -0
- /package/node_modules/{conventional-changelog-express → standard-version/node_modules/conventional-changelog-express}/writer-opts.js +0 -0
- /package/node_modules/{conventional-changelog-jquery → standard-version/node_modules/conventional-changelog-jquery}/CHANGELOG.md +0 -0
- /package/node_modules/{conventional-changelog-jquery → standard-version/node_modules/conventional-changelog-jquery}/LICENSE.md +0 -0
- /package/node_modules/{conventional-changelog-jquery → standard-version/node_modules/conventional-changelog-jquery}/README.md +0 -0
- /package/node_modules/{conventional-changelog-jquery → standard-version/node_modules/conventional-changelog-jquery}/conventional-changelog.js +0 -0
- /package/node_modules/{conventional-changelog-jquery → standard-version/node_modules/conventional-changelog-jquery}/conventional-recommended-bump.js +0 -0
- /package/node_modules/{conventional-changelog-jquery → standard-version/node_modules/conventional-changelog-jquery}/index.js +0 -0
- /package/node_modules/{conventional-changelog-jquery → standard-version/node_modules/conventional-changelog-jquery}/package.json +0 -0
- /package/node_modules/{conventional-changelog-jquery → standard-version/node_modules/conventional-changelog-jquery}/parser-opts.js +0 -0
- /package/node_modules/{conventional-changelog-jquery → standard-version/node_modules/conventional-changelog-jquery}/templates/commit.hbs +0 -0
- /package/node_modules/{conventional-changelog-jquery → standard-version/node_modules/conventional-changelog-jquery}/templates/header.hbs +0 -0
- /package/node_modules/{conventional-changelog-jquery → standard-version/node_modules/conventional-changelog-jquery}/templates/template.hbs +0 -0
- /package/node_modules/{conventional-changelog-jquery → standard-version/node_modules/conventional-changelog-jquery}/writer-opts.js +0 -0
- /package/node_modules/{conventional-changelog-jshint → standard-version/node_modules/conventional-changelog-jshint}/CHANGELOG.md +0 -0
- /package/node_modules/{conventional-changelog-jshint → standard-version/node_modules/conventional-changelog-jshint}/LICENSE.md +0 -0
- /package/node_modules/{conventional-changelog-jshint → standard-version/node_modules/conventional-changelog-jshint}/README.md +0 -0
- /package/node_modules/{conventional-changelog-jshint → standard-version/node_modules/conventional-changelog-jshint}/conventional-changelog.js +0 -0
- /package/node_modules/{conventional-changelog-jshint → standard-version/node_modules/conventional-changelog-jshint}/conventional-recommended-bump.js +0 -0
- /package/node_modules/{conventional-changelog-jshint → standard-version/node_modules/conventional-changelog-jshint}/index.js +0 -0
- /package/node_modules/{conventional-changelog-jshint → standard-version/node_modules/conventional-changelog-jshint}/package.json +0 -0
- /package/node_modules/{conventional-changelog-jshint → standard-version/node_modules/conventional-changelog-jshint}/parser-opts.js +0 -0
- /package/node_modules/{conventional-changelog-jshint → standard-version/node_modules/conventional-changelog-jshint}/templates/commit.hbs +0 -0
- /package/node_modules/{conventional-changelog-jshint → standard-version/node_modules/conventional-changelog-jshint}/templates/footer.hbs +0 -0
- /package/node_modules/{conventional-changelog-jshint → standard-version/node_modules/conventional-changelog-jshint}/templates/header.hbs +0 -0
- /package/node_modules/{conventional-changelog-jshint → standard-version/node_modules/conventional-changelog-jshint}/templates/template.hbs +0 -0
- /package/node_modules/{conventional-changelog-jshint → standard-version/node_modules/conventional-changelog-jshint}/writer-opts.js +0 -0
- /package/node_modules/{conventional-changelog-preset-loader → standard-version/node_modules/conventional-changelog-preset-loader}/CHANGELOG.md +0 -0
- /package/node_modules/{conventional-changelog-preset-loader → standard-version/node_modules/conventional-changelog-preset-loader}/LICENSE.md +0 -0
- /package/node_modules/{conventional-changelog-preset-loader → standard-version/node_modules/conventional-changelog-preset-loader}/README.md +0 -0
- /package/node_modules/{conventional-changelog-preset-loader → standard-version/node_modules/conventional-changelog-preset-loader}/index.js +0 -0
- /package/node_modules/{conventional-changelog-preset-loader → standard-version/node_modules/conventional-changelog-preset-loader}/package.json +0 -0
- /package/node_modules/{conventional-changelog-writer → standard-version/node_modules/conventional-changelog-writer}/CHANGELOG.md +0 -0
- /package/node_modules/{conventional-changelog-writer → standard-version/node_modules/conventional-changelog-writer}/LICENSE.md +0 -0
- /package/node_modules/{conventional-changelog-writer → standard-version/node_modules/conventional-changelog-writer}/README.md +0 -0
- /package/node_modules/{conventional-changelog-writer → standard-version/node_modules/conventional-changelog-writer}/cli.js +0 -0
- /package/node_modules/{conventional-changelog-writer → standard-version/node_modules/conventional-changelog-writer}/index.js +0 -0
- /package/node_modules/{conventional-changelog-writer → standard-version/node_modules/conventional-changelog-writer}/lib/util.js +0 -0
- /package/node_modules/{git-semver-tags → standard-version/node_modules/conventional-changelog-writer}/node_modules/semver/LICENSE +0 -0
- /package/node_modules/{conventional-changelog-writer → standard-version/node_modules/conventional-changelog-writer}/node_modules/semver/README.md +0 -0
- /package/node_modules/{conventional-changelog-writer → standard-version/node_modules/conventional-changelog-writer}/node_modules/semver/bin/semver.js +0 -0
- /package/node_modules/{conventional-changelog-writer → standard-version/node_modules/conventional-changelog-writer}/node_modules/semver/package.json +0 -0
- /package/node_modules/{conventional-changelog-writer → standard-version/node_modules/conventional-changelog-writer}/node_modules/semver/range.bnf +0 -0
- /package/node_modules/{conventional-changelog-writer → standard-version/node_modules/conventional-changelog-writer}/node_modules/semver/semver.js +0 -0
- /package/node_modules/{conventional-changelog-writer → standard-version/node_modules/conventional-changelog-writer}/package.json +0 -0
- /package/node_modules/{conventional-changelog-writer → standard-version/node_modules/conventional-changelog-writer}/templates/commit.hbs +0 -0
- /package/node_modules/{conventional-changelog-writer → standard-version/node_modules/conventional-changelog-writer}/templates/footer.hbs +0 -0
- /package/node_modules/{conventional-changelog-writer → standard-version/node_modules/conventional-changelog-writer}/templates/header.hbs +0 -0
- /package/node_modules/{conventional-changelog-writer → standard-version/node_modules/conventional-changelog-writer}/templates/template.hbs +0 -0
- /package/node_modules/{conventional-commits-filter → standard-version/node_modules/conventional-commits-filter}/CHANGELOG.md +0 -0
- /package/node_modules/{conventional-commits-filter → standard-version/node_modules/conventional-commits-filter}/LICENSE +0 -0
- /package/node_modules/{conventional-commits-filter → standard-version/node_modules/conventional-commits-filter}/README.md +0 -0
- /package/node_modules/{conventional-commits-filter → standard-version/node_modules/conventional-commits-filter}/index.js +0 -0
- /package/node_modules/{conventional-commits-filter → standard-version/node_modules/conventional-commits-filter}/package.json +0 -0
- /package/node_modules/{conventional-commits-parser → standard-version/node_modules/conventional-commits-parser}/CHANGELOG.md +0 -0
- /package/node_modules/{conventional-commits-parser → standard-version/node_modules/conventional-commits-parser}/LICENSE.md +0 -0
- /package/node_modules/{conventional-commits-parser → standard-version/node_modules/conventional-commits-parser}/README.md +0 -0
- /package/node_modules/{conventional-commits-parser → standard-version/node_modules/conventional-commits-parser}/cli.js +0 -0
- /package/node_modules/{conventional-commits-parser → standard-version/node_modules/conventional-commits-parser}/index.js +0 -0
- /package/node_modules/{conventional-commits-parser → standard-version/node_modules/conventional-commits-parser}/lib/parser.js +0 -0
- /package/node_modules/{conventional-commits-parser → standard-version/node_modules/conventional-commits-parser}/lib/regex.js +0 -0
- /package/node_modules/{conventional-commits-parser → standard-version/node_modules/conventional-commits-parser}/package.json +0 -0
- /package/node_modules/{conventional-recommended-bump → standard-version/node_modules/conventional-recommended-bump}/CHANGELOG.md +0 -0
- /package/node_modules/{conventional-recommended-bump → standard-version/node_modules/conventional-recommended-bump}/LICENSE.md +0 -0
- /package/node_modules/{conventional-recommended-bump → standard-version/node_modules/conventional-recommended-bump}/README.md +0 -0
- /package/node_modules/{conventional-recommended-bump → standard-version/node_modules/conventional-recommended-bump}/cli.js +0 -0
- /package/node_modules/{conventional-recommended-bump → standard-version/node_modules/conventional-recommended-bump}/index.js +0 -0
- /package/node_modules/{conventional-recommended-bump → standard-version/node_modules/conventional-recommended-bump}/package.json +0 -0
- /package/node_modules/{conventional-recommended-bump → standard-version/node_modules/conventional-recommended-bump}/preset-resolver.js +0 -0
- /package/node_modules/{git-raw-commits → standard-version/node_modules/git-raw-commits}/CHANGELOG.md +0 -0
- /package/node_modules/{git-raw-commits → standard-version/node_modules/git-raw-commits}/LICENSE.md +0 -0
- /package/node_modules/{git-raw-commits → standard-version/node_modules/git-raw-commits}/README.md +0 -0
- /package/node_modules/{git-raw-commits → standard-version/node_modules/git-raw-commits}/cli.js +0 -0
- /package/node_modules/{git-raw-commits → standard-version/node_modules/git-raw-commits}/index.js +0 -0
- /package/node_modules/{git-raw-commits → standard-version/node_modules/git-raw-commits}/package.json +0 -0
- /package/node_modules/{git-semver-tags → standard-version/node_modules/git-semver-tags}/CHANGELOG.md +0 -0
- /package/node_modules/{git-semver-tags → standard-version/node_modules/git-semver-tags}/LICENSE.md +0 -0
- /package/node_modules/{git-semver-tags → standard-version/node_modules/git-semver-tags}/README.md +0 -0
- /package/node_modules/{git-semver-tags → standard-version/node_modules/git-semver-tags}/cli.js +0 -0
- /package/node_modules/{git-semver-tags → standard-version/node_modules/git-semver-tags}/index.js +0 -0
- /package/node_modules/{hosted-git-info/node_modules/lru-cache → standard-version/node_modules/git-semver-tags/node_modules/semver}/LICENSE +0 -0
- /package/node_modules/{git-semver-tags → standard-version/node_modules/git-semver-tags}/node_modules/semver/README.md +0 -0
- /package/node_modules/{git-semver-tags → standard-version/node_modules/git-semver-tags}/node_modules/semver/bin/semver.js +0 -0
- /package/node_modules/{git-semver-tags → standard-version/node_modules/git-semver-tags}/node_modules/semver/package.json +0 -0
- /package/node_modules/{git-semver-tags → standard-version/node_modules/git-semver-tags}/node_modules/semver/range.bnf +0 -0
- /package/node_modules/{git-semver-tags → standard-version/node_modules/git-semver-tags}/node_modules/semver/semver.js +0 -0
- /package/node_modules/{git-semver-tags → standard-version/node_modules/git-semver-tags}/package.json +0 -0
- /package/node_modules/{get-pkg-repo → standard-version}/node_modules/through2/LICENSE.md +0 -0
- /package/node_modules/{@babel/highlight/node_modules/supports-color → supports-color}/browser.js +0 -0
- /package/node_modules/{@babel/highlight/node_modules/supports-color → supports-color}/index.js +0 -0
- /package/node_modules/{@babel/highlight/node_modules/supports-color → supports-color}/license +0 -0
- /package/node_modules/{@babel/highlight/node_modules/supports-color → supports-color}/package.json +0 -0
- /package/node_modules/{@babel/highlight/node_modules/supports-color → supports-color}/readme.md +0 -0
- /package/node_modules/{get-pkg-repo → through2}/node_modules/isarray/.npmignore +0 -0
- /package/node_modules/{get-pkg-repo → through2}/node_modules/isarray/.travis.yml +0 -0
- /package/node_modules/{get-pkg-repo → through2}/node_modules/isarray/Makefile +0 -0
- /package/node_modules/{get-pkg-repo → through2}/node_modules/isarray/README.md +0 -0
- /package/node_modules/{get-pkg-repo → through2}/node_modules/isarray/component.json +0 -0
- /package/node_modules/{get-pkg-repo → through2}/node_modules/isarray/index.js +0 -0
- /package/node_modules/{get-pkg-repo → through2}/node_modules/isarray/package.json +0 -0
- /package/node_modules/{get-pkg-repo → through2}/node_modules/isarray/test.js +0 -0
- /package/node_modules/{get-pkg-repo → through2}/node_modules/readable-stream/.travis.yml +0 -0
- /package/node_modules/{get-pkg-repo → through2}/node_modules/readable-stream/CONTRIBUTING.md +0 -0
- /package/node_modules/{get-pkg-repo → through2}/node_modules/readable-stream/GOVERNANCE.md +0 -0
- /package/node_modules/{get-pkg-repo → through2}/node_modules/readable-stream/LICENSE +0 -0
- /package/node_modules/{get-pkg-repo → through2}/node_modules/readable-stream/README.md +0 -0
- /package/node_modules/{get-pkg-repo → through2}/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md +0 -0
- /package/node_modules/{get-pkg-repo → through2}/node_modules/readable-stream/duplex-browser.js +0 -0
- /package/node_modules/{get-pkg-repo → through2}/node_modules/readable-stream/duplex.js +0 -0
- /package/node_modules/{get-pkg-repo → through2}/node_modules/readable-stream/lib/_stream_duplex.js +0 -0
- /package/node_modules/{get-pkg-repo → through2}/node_modules/readable-stream/lib/_stream_passthrough.js +0 -0
- /package/node_modules/{get-pkg-repo → through2}/node_modules/readable-stream/lib/_stream_readable.js +0 -0
- /package/node_modules/{get-pkg-repo → through2}/node_modules/readable-stream/lib/_stream_transform.js +0 -0
- /package/node_modules/{get-pkg-repo → through2}/node_modules/readable-stream/lib/_stream_writable.js +0 -0
- /package/node_modules/{get-pkg-repo → through2}/node_modules/readable-stream/lib/internal/streams/BufferList.js +0 -0
- /package/node_modules/{get-pkg-repo → through2}/node_modules/readable-stream/lib/internal/streams/destroy.js +0 -0
- /package/node_modules/{get-pkg-repo → through2}/node_modules/readable-stream/lib/internal/streams/stream-browser.js +0 -0
- /package/node_modules/{get-pkg-repo → through2}/node_modules/readable-stream/lib/internal/streams/stream.js +0 -0
- /package/node_modules/{get-pkg-repo → through2}/node_modules/readable-stream/package.json +0 -0
- /package/node_modules/{get-pkg-repo → through2}/node_modules/readable-stream/passthrough.js +0 -0
- /package/node_modules/{get-pkg-repo → through2}/node_modules/readable-stream/readable-browser.js +0 -0
- /package/node_modules/{get-pkg-repo → through2}/node_modules/readable-stream/readable.js +0 -0
- /package/node_modules/{get-pkg-repo → through2}/node_modules/readable-stream/transform.js +0 -0
- /package/node_modules/{get-pkg-repo → through2}/node_modules/readable-stream/writable-browser.js +0 -0
- /package/node_modules/{get-pkg-repo → through2}/node_modules/readable-stream/writable.js +0 -0
- /package/node_modules/{get-pkg-repo → through2}/node_modules/safe-buffer/LICENSE +0 -0
- /package/node_modules/{get-pkg-repo → through2}/node_modules/safe-buffer/README.md +0 -0
- /package/node_modules/{get-pkg-repo → through2}/node_modules/safe-buffer/index.d.ts +0 -0
- /package/node_modules/{get-pkg-repo → through2}/node_modules/safe-buffer/index.js +0 -0
- /package/node_modules/{get-pkg-repo → through2}/node_modules/safe-buffer/package.json +0 -0
- /package/node_modules/{get-pkg-repo → through2}/node_modules/string_decoder/.travis.yml +0 -0
- /package/node_modules/{get-pkg-repo → through2}/node_modules/string_decoder/LICENSE +0 -0
- /package/node_modules/{get-pkg-repo → through2}/node_modules/string_decoder/README.md +0 -0
- /package/node_modules/{get-pkg-repo → through2}/node_modules/string_decoder/lib/string_decoder.js +0 -0
- /package/node_modules/{get-pkg-repo → through2}/node_modules/string_decoder/package.json +0 -0
- /package/node_modules/{ansi-styles → wrap-ansi/node_modules/ansi-styles}/index.d.ts +0 -0
- /package/node_modules/{standard-version → wrap-ansi}/node_modules/ansi-styles/license +0 -0
- /package/node_modules/{@babel/highlight → wrap-ansi}/node_modules/color-convert/CHANGELOG.md +0 -0
- /package/node_modules/{@babel/highlight → wrap-ansi}/node_modules/color-convert/LICENSE +0 -0
- /package/node_modules/{@babel/highlight → wrap-ansi}/node_modules/color-convert/README.md +0 -0
- /package/node_modules/{@babel/highlight → wrap-ansi}/node_modules/color-name/LICENSE +0 -0
- /package/node_modules/{@babel/highlight → wrap-ansi}/node_modules/color-name/README.md +0 -0
- /package/node_modules/{@babel/highlight → wrap-ansi}/node_modules/color-name/index.js +0 -0
- /package/node_modules/{hosted-git-info/node_modules/yallist → yallist}/LICENSE +0 -0
- /package/node_modules/{hosted-git-info/node_modules/yallist → yallist}/README.md +0 -0
- /package/node_modules/{hosted-git-info/node_modules/yallist → yallist}/iterator.js +0 -0
- /package/node_modules/{hosted-git-info/node_modules/yallist → yallist}/package.json +0 -0
- /package/node_modules/{hosted-git-info/node_modules/yallist → yallist}/yallist.js +0 -0
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
/* MIT license */
|
|
2
|
-
|
|
3
|
-
const cssKeywords = require('color-name');
|
|
2
|
+
var cssKeywords = require('color-name');
|
|
4
3
|
|
|
5
4
|
// NOTE: conversions should only return primitive values (i.e. arrays, or
|
|
6
5
|
// values that give correct `typeof` results).
|
|
7
6
|
// do not use box values types (i.e. Number(), String(), etc.)
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
for (
|
|
11
|
-
|
|
8
|
+
var reverseKeywords = {};
|
|
9
|
+
for (var key in cssKeywords) {
|
|
10
|
+
if (cssKeywords.hasOwnProperty(key)) {
|
|
11
|
+
reverseKeywords[cssKeywords[key]] = key;
|
|
12
|
+
}
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
var convert = module.exports = {
|
|
15
16
|
rgb: {channels: 3, labels: 'rgb'},
|
|
16
17
|
hsl: {channels: 3, labels: 'hsl'},
|
|
17
18
|
hsv: {channels: 3, labels: 'hsv'},
|
|
@@ -29,38 +30,40 @@ const convert = {
|
|
|
29
30
|
gray: {channels: 1, labels: ['gray']}
|
|
30
31
|
};
|
|
31
32
|
|
|
32
|
-
|
|
33
|
+
// hide .channels and .labels properties
|
|
34
|
+
for (var model in convert) {
|
|
35
|
+
if (convert.hasOwnProperty(model)) {
|
|
36
|
+
if (!('channels' in convert[model])) {
|
|
37
|
+
throw new Error('missing channels property: ' + model);
|
|
38
|
+
}
|
|
33
39
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
throw new Error('missing channels property: ' + model);
|
|
38
|
-
}
|
|
40
|
+
if (!('labels' in convert[model])) {
|
|
41
|
+
throw new Error('missing channel labels property: ' + model);
|
|
42
|
+
}
|
|
39
43
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
if (convert[model].labels.length !== convert[model].channels) {
|
|
45
|
+
throw new Error('channel and label counts mismatch: ' + model);
|
|
46
|
+
}
|
|
43
47
|
|
|
44
|
-
|
|
45
|
-
|
|
48
|
+
var channels = convert[model].channels;
|
|
49
|
+
var labels = convert[model].labels;
|
|
50
|
+
delete convert[model].channels;
|
|
51
|
+
delete convert[model].labels;
|
|
52
|
+
Object.defineProperty(convert[model], 'channels', {value: channels});
|
|
53
|
+
Object.defineProperty(convert[model], 'labels', {value: labels});
|
|
46
54
|
}
|
|
47
|
-
|
|
48
|
-
const {channels, labels} = convert[model];
|
|
49
|
-
delete convert[model].channels;
|
|
50
|
-
delete convert[model].labels;
|
|
51
|
-
Object.defineProperty(convert[model], 'channels', {value: channels});
|
|
52
|
-
Object.defineProperty(convert[model], 'labels', {value: labels});
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
convert.rgb.hsl = function (rgb) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
58
|
+
var r = rgb[0] / 255;
|
|
59
|
+
var g = rgb[1] / 255;
|
|
60
|
+
var b = rgb[2] / 255;
|
|
61
|
+
var min = Math.min(r, g, b);
|
|
62
|
+
var max = Math.max(r, g, b);
|
|
63
|
+
var delta = max - min;
|
|
64
|
+
var h;
|
|
65
|
+
var s;
|
|
66
|
+
var l;
|
|
64
67
|
|
|
65
68
|
if (max === min) {
|
|
66
69
|
h = 0;
|
|
@@ -78,7 +81,7 @@ convert.rgb.hsl = function (rgb) {
|
|
|
78
81
|
h += 360;
|
|
79
82
|
}
|
|
80
83
|
|
|
81
|
-
|
|
84
|
+
l = (min + max) / 2;
|
|
82
85
|
|
|
83
86
|
if (max === min) {
|
|
84
87
|
s = 0;
|
|
@@ -92,24 +95,23 @@ convert.rgb.hsl = function (rgb) {
|
|
|
92
95
|
};
|
|
93
96
|
|
|
94
97
|
convert.rgb.hsv = function (rgb) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
98
|
+
var rdif;
|
|
99
|
+
var gdif;
|
|
100
|
+
var bdif;
|
|
101
|
+
var h;
|
|
102
|
+
var s;
|
|
103
|
+
|
|
104
|
+
var r = rgb[0] / 255;
|
|
105
|
+
var g = rgb[1] / 255;
|
|
106
|
+
var b = rgb[2] / 255;
|
|
107
|
+
var v = Math.max(r, g, b);
|
|
108
|
+
var diff = v - Math.min(r, g, b);
|
|
109
|
+
var diffc = function (c) {
|
|
107
110
|
return (v - c) / 6 / diff + 1 / 2;
|
|
108
111
|
};
|
|
109
112
|
|
|
110
113
|
if (diff === 0) {
|
|
111
|
-
h = 0;
|
|
112
|
-
s = 0;
|
|
114
|
+
h = s = 0;
|
|
113
115
|
} else {
|
|
114
116
|
s = diff / v;
|
|
115
117
|
rdif = diffc(r);
|
|
@@ -123,7 +125,6 @@ convert.rgb.hsv = function (rgb) {
|
|
|
123
125
|
} else if (b === v) {
|
|
124
126
|
h = (2 / 3) + gdif - rdif;
|
|
125
127
|
}
|
|
126
|
-
|
|
127
128
|
if (h < 0) {
|
|
128
129
|
h += 1;
|
|
129
130
|
} else if (h > 1) {
|
|
@@ -139,11 +140,11 @@ convert.rgb.hsv = function (rgb) {
|
|
|
139
140
|
};
|
|
140
141
|
|
|
141
142
|
convert.rgb.hwb = function (rgb) {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
143
|
+
var r = rgb[0];
|
|
144
|
+
var g = rgb[1];
|
|
145
|
+
var b = rgb[2];
|
|
146
|
+
var h = convert.rgb.hsl(rgb)[0];
|
|
147
|
+
var w = 1 / 255 * Math.min(r, Math.min(g, b));
|
|
147
148
|
|
|
148
149
|
b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
|
|
149
150
|
|
|
@@ -151,48 +152,54 @@ convert.rgb.hwb = function (rgb) {
|
|
|
151
152
|
};
|
|
152
153
|
|
|
153
154
|
convert.rgb.cmyk = function (rgb) {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
155
|
+
var r = rgb[0] / 255;
|
|
156
|
+
var g = rgb[1] / 255;
|
|
157
|
+
var b = rgb[2] / 255;
|
|
158
|
+
var c;
|
|
159
|
+
var m;
|
|
160
|
+
var y;
|
|
161
|
+
var k;
|
|
162
|
+
|
|
163
|
+
k = Math.min(1 - r, 1 - g, 1 - b);
|
|
164
|
+
c = (1 - r - k) / (1 - k) || 0;
|
|
165
|
+
m = (1 - g - k) / (1 - k) || 0;
|
|
166
|
+
y = (1 - b - k) / (1 - k) || 0;
|
|
162
167
|
|
|
163
168
|
return [c * 100, m * 100, y * 100, k * 100];
|
|
164
169
|
};
|
|
165
170
|
|
|
171
|
+
/**
|
|
172
|
+
* See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
|
173
|
+
* */
|
|
166
174
|
function comparativeDistance(x, y) {
|
|
167
|
-
/*
|
|
168
|
-
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
|
169
|
-
*/
|
|
170
175
|
return (
|
|
171
|
-
(
|
|
172
|
-
(
|
|
173
|
-
(
|
|
176
|
+
Math.pow(x[0] - y[0], 2) +
|
|
177
|
+
Math.pow(x[1] - y[1], 2) +
|
|
178
|
+
Math.pow(x[2] - y[2], 2)
|
|
174
179
|
);
|
|
175
180
|
}
|
|
176
181
|
|
|
177
182
|
convert.rgb.keyword = function (rgb) {
|
|
178
|
-
|
|
183
|
+
var reversed = reverseKeywords[rgb];
|
|
179
184
|
if (reversed) {
|
|
180
185
|
return reversed;
|
|
181
186
|
}
|
|
182
187
|
|
|
183
|
-
|
|
184
|
-
|
|
188
|
+
var currentClosestDistance = Infinity;
|
|
189
|
+
var currentClosestKeyword;
|
|
185
190
|
|
|
186
|
-
for (
|
|
187
|
-
|
|
191
|
+
for (var keyword in cssKeywords) {
|
|
192
|
+
if (cssKeywords.hasOwnProperty(keyword)) {
|
|
193
|
+
var value = cssKeywords[keyword];
|
|
188
194
|
|
|
189
|
-
|
|
190
|
-
|
|
195
|
+
// Compute comparative distance
|
|
196
|
+
var distance = comparativeDistance(rgb, value);
|
|
191
197
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
198
|
+
// Check if its less, if so set as closest
|
|
199
|
+
if (distance < currentClosestDistance) {
|
|
200
|
+
currentClosestDistance = distance;
|
|
201
|
+
currentClosestKeyword = keyword;
|
|
202
|
+
}
|
|
196
203
|
}
|
|
197
204
|
}
|
|
198
205
|
|
|
@@ -204,50 +211,55 @@ convert.keyword.rgb = function (keyword) {
|
|
|
204
211
|
};
|
|
205
212
|
|
|
206
213
|
convert.rgb.xyz = function (rgb) {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
214
|
+
var r = rgb[0] / 255;
|
|
215
|
+
var g = rgb[1] / 255;
|
|
216
|
+
var b = rgb[2] / 255;
|
|
210
217
|
|
|
211
|
-
//
|
|
212
|
-
r = r > 0.04045 ? (((r + 0.055) / 1.055)
|
|
213
|
-
g = g > 0.04045 ? (((g + 0.055) / 1.055)
|
|
214
|
-
b = b > 0.04045 ? (((b + 0.055) / 1.055)
|
|
218
|
+
// assume sRGB
|
|
219
|
+
r = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92);
|
|
220
|
+
g = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92);
|
|
221
|
+
b = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92);
|
|
215
222
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
223
|
+
var x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
|
|
224
|
+
var y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
|
|
225
|
+
var z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
|
|
219
226
|
|
|
220
227
|
return [x * 100, y * 100, z * 100];
|
|
221
228
|
};
|
|
222
229
|
|
|
223
230
|
convert.rgb.lab = function (rgb) {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
231
|
+
var xyz = convert.rgb.xyz(rgb);
|
|
232
|
+
var x = xyz[0];
|
|
233
|
+
var y = xyz[1];
|
|
234
|
+
var z = xyz[2];
|
|
235
|
+
var l;
|
|
236
|
+
var a;
|
|
237
|
+
var b;
|
|
228
238
|
|
|
229
239
|
x /= 95.047;
|
|
230
240
|
y /= 100;
|
|
231
241
|
z /= 108.883;
|
|
232
242
|
|
|
233
|
-
x = x > 0.008856 ? (x
|
|
234
|
-
y = y > 0.008856 ? (y
|
|
235
|
-
z = z > 0.008856 ? (z
|
|
243
|
+
x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);
|
|
244
|
+
y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);
|
|
245
|
+
z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);
|
|
236
246
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
247
|
+
l = (116 * y) - 16;
|
|
248
|
+
a = 500 * (x - y);
|
|
249
|
+
b = 200 * (y - z);
|
|
240
250
|
|
|
241
251
|
return [l, a, b];
|
|
242
252
|
};
|
|
243
253
|
|
|
244
254
|
convert.hsl.rgb = function (hsl) {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
255
|
+
var h = hsl[0] / 360;
|
|
256
|
+
var s = hsl[1] / 100;
|
|
257
|
+
var l = hsl[2] / 100;
|
|
258
|
+
var t1;
|
|
259
|
+
var t2;
|
|
260
|
+
var t3;
|
|
261
|
+
var rgb;
|
|
262
|
+
var val;
|
|
251
263
|
|
|
252
264
|
if (s === 0) {
|
|
253
265
|
val = l * 255;
|
|
@@ -260,15 +272,14 @@ convert.hsl.rgb = function (hsl) {
|
|
|
260
272
|
t2 = l + s - l * s;
|
|
261
273
|
}
|
|
262
274
|
|
|
263
|
-
|
|
275
|
+
t1 = 2 * l - t2;
|
|
264
276
|
|
|
265
|
-
|
|
266
|
-
for (
|
|
277
|
+
rgb = [0, 0, 0];
|
|
278
|
+
for (var i = 0; i < 3; i++) {
|
|
267
279
|
t3 = h + 1 / 3 * -(i - 1);
|
|
268
280
|
if (t3 < 0) {
|
|
269
281
|
t3++;
|
|
270
282
|
}
|
|
271
|
-
|
|
272
283
|
if (t3 > 1) {
|
|
273
284
|
t3--;
|
|
274
285
|
}
|
|
@@ -290,31 +301,33 @@ convert.hsl.rgb = function (hsl) {
|
|
|
290
301
|
};
|
|
291
302
|
|
|
292
303
|
convert.hsl.hsv = function (hsl) {
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
304
|
+
var h = hsl[0];
|
|
305
|
+
var s = hsl[1] / 100;
|
|
306
|
+
var l = hsl[2] / 100;
|
|
307
|
+
var smin = s;
|
|
308
|
+
var lmin = Math.max(l, 0.01);
|
|
309
|
+
var sv;
|
|
310
|
+
var v;
|
|
298
311
|
|
|
299
312
|
l *= 2;
|
|
300
313
|
s *= (l <= 1) ? l : 2 - l;
|
|
301
314
|
smin *= lmin <= 1 ? lmin : 2 - lmin;
|
|
302
|
-
|
|
303
|
-
|
|
315
|
+
v = (l + s) / 2;
|
|
316
|
+
sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
|
|
304
317
|
|
|
305
318
|
return [h, sv * 100, v * 100];
|
|
306
319
|
};
|
|
307
320
|
|
|
308
321
|
convert.hsv.rgb = function (hsv) {
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
322
|
+
var h = hsv[0] / 60;
|
|
323
|
+
var s = hsv[1] / 100;
|
|
324
|
+
var v = hsv[2] / 100;
|
|
325
|
+
var hi = Math.floor(h) % 6;
|
|
326
|
+
|
|
327
|
+
var f = h - Math.floor(h);
|
|
328
|
+
var p = 255 * v * (1 - s);
|
|
329
|
+
var q = 255 * v * (1 - (s * f));
|
|
330
|
+
var t = 255 * v * (1 - (s * (1 - f)));
|
|
318
331
|
v *= 255;
|
|
319
332
|
|
|
320
333
|
switch (hi) {
|
|
@@ -334,15 +347,16 @@ convert.hsv.rgb = function (hsv) {
|
|
|
334
347
|
};
|
|
335
348
|
|
|
336
349
|
convert.hsv.hsl = function (hsv) {
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
350
|
+
var h = hsv[0];
|
|
351
|
+
var s = hsv[1] / 100;
|
|
352
|
+
var v = hsv[2] / 100;
|
|
353
|
+
var vmin = Math.max(v, 0.01);
|
|
354
|
+
var lmin;
|
|
355
|
+
var sl;
|
|
356
|
+
var l;
|
|
343
357
|
|
|
344
358
|
l = (2 - s) * v;
|
|
345
|
-
|
|
359
|
+
lmin = (2 - s) * vmin;
|
|
346
360
|
sl = s * vmin;
|
|
347
361
|
sl /= (lmin <= 1) ? lmin : 2 - lmin;
|
|
348
362
|
sl = sl || 0;
|
|
@@ -353,83 +367,87 @@ convert.hsv.hsl = function (hsv) {
|
|
|
353
367
|
|
|
354
368
|
// http://dev.w3.org/csswg/css-color/#hwb-to-rgb
|
|
355
369
|
convert.hwb.rgb = function (hwb) {
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
370
|
+
var h = hwb[0] / 360;
|
|
371
|
+
var wh = hwb[1] / 100;
|
|
372
|
+
var bl = hwb[2] / 100;
|
|
373
|
+
var ratio = wh + bl;
|
|
374
|
+
var i;
|
|
375
|
+
var v;
|
|
376
|
+
var f;
|
|
377
|
+
var n;
|
|
378
|
+
|
|
379
|
+
// wh + bl cant be > 1
|
|
363
380
|
if (ratio > 1) {
|
|
364
381
|
wh /= ratio;
|
|
365
382
|
bl /= ratio;
|
|
366
383
|
}
|
|
367
384
|
|
|
368
|
-
|
|
369
|
-
|
|
385
|
+
i = Math.floor(6 * h);
|
|
386
|
+
v = 1 - bl;
|
|
370
387
|
f = 6 * h - i;
|
|
371
388
|
|
|
372
389
|
if ((i & 0x01) !== 0) {
|
|
373
390
|
f = 1 - f;
|
|
374
391
|
}
|
|
375
392
|
|
|
376
|
-
|
|
393
|
+
n = wh + f * (v - wh); // linear interpolation
|
|
377
394
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
/* eslint-disable max-statements-per-line,no-multi-spaces */
|
|
395
|
+
var r;
|
|
396
|
+
var g;
|
|
397
|
+
var b;
|
|
382
398
|
switch (i) {
|
|
383
399
|
default:
|
|
384
400
|
case 6:
|
|
385
|
-
case 0: r = v;
|
|
386
|
-
case 1: r = n;
|
|
387
|
-
case 2: r = wh; g = v;
|
|
388
|
-
case 3: r = wh; g = n;
|
|
389
|
-
case 4: r = n;
|
|
390
|
-
case 5: r = v;
|
|
401
|
+
case 0: r = v; g = n; b = wh; break;
|
|
402
|
+
case 1: r = n; g = v; b = wh; break;
|
|
403
|
+
case 2: r = wh; g = v; b = n; break;
|
|
404
|
+
case 3: r = wh; g = n; b = v; break;
|
|
405
|
+
case 4: r = n; g = wh; b = v; break;
|
|
406
|
+
case 5: r = v; g = wh; b = n; break;
|
|
391
407
|
}
|
|
392
|
-
/* eslint-enable max-statements-per-line,no-multi-spaces */
|
|
393
408
|
|
|
394
409
|
return [r * 255, g * 255, b * 255];
|
|
395
410
|
};
|
|
396
411
|
|
|
397
412
|
convert.cmyk.rgb = function (cmyk) {
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
413
|
+
var c = cmyk[0] / 100;
|
|
414
|
+
var m = cmyk[1] / 100;
|
|
415
|
+
var y = cmyk[2] / 100;
|
|
416
|
+
var k = cmyk[3] / 100;
|
|
417
|
+
var r;
|
|
418
|
+
var g;
|
|
419
|
+
var b;
|
|
420
|
+
|
|
421
|
+
r = 1 - Math.min(1, c * (1 - k) + k);
|
|
422
|
+
g = 1 - Math.min(1, m * (1 - k) + k);
|
|
423
|
+
b = 1 - Math.min(1, y * (1 - k) + k);
|
|
406
424
|
|
|
407
425
|
return [r * 255, g * 255, b * 255];
|
|
408
426
|
};
|
|
409
427
|
|
|
410
428
|
convert.xyz.rgb = function (xyz) {
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
429
|
+
var x = xyz[0] / 100;
|
|
430
|
+
var y = xyz[1] / 100;
|
|
431
|
+
var z = xyz[2] / 100;
|
|
432
|
+
var r;
|
|
433
|
+
var g;
|
|
434
|
+
var b;
|
|
417
435
|
|
|
418
436
|
r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
|
|
419
437
|
g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
|
|
420
438
|
b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
|
|
421
439
|
|
|
422
|
-
//
|
|
440
|
+
// assume sRGB
|
|
423
441
|
r = r > 0.0031308
|
|
424
|
-
? ((1.055 * (r
|
|
442
|
+
? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055)
|
|
425
443
|
: r * 12.92;
|
|
426
444
|
|
|
427
445
|
g = g > 0.0031308
|
|
428
|
-
? ((1.055 * (g
|
|
446
|
+
? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055)
|
|
429
447
|
: g * 12.92;
|
|
430
448
|
|
|
431
449
|
b = b > 0.0031308
|
|
432
|
-
? ((1.055 * (b
|
|
450
|
+
? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055)
|
|
433
451
|
: b * 12.92;
|
|
434
452
|
|
|
435
453
|
r = Math.min(Math.max(0, r), 1);
|
|
@@ -440,40 +458,43 @@ convert.xyz.rgb = function (xyz) {
|
|
|
440
458
|
};
|
|
441
459
|
|
|
442
460
|
convert.xyz.lab = function (xyz) {
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
461
|
+
var x = xyz[0];
|
|
462
|
+
var y = xyz[1];
|
|
463
|
+
var z = xyz[2];
|
|
464
|
+
var l;
|
|
465
|
+
var a;
|
|
466
|
+
var b;
|
|
446
467
|
|
|
447
468
|
x /= 95.047;
|
|
448
469
|
y /= 100;
|
|
449
470
|
z /= 108.883;
|
|
450
471
|
|
|
451
|
-
x = x > 0.008856 ? (x
|
|
452
|
-
y = y > 0.008856 ? (y
|
|
453
|
-
z = z > 0.008856 ? (z
|
|
472
|
+
x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);
|
|
473
|
+
y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);
|
|
474
|
+
z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);
|
|
454
475
|
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
476
|
+
l = (116 * y) - 16;
|
|
477
|
+
a = 500 * (x - y);
|
|
478
|
+
b = 200 * (y - z);
|
|
458
479
|
|
|
459
480
|
return [l, a, b];
|
|
460
481
|
};
|
|
461
482
|
|
|
462
483
|
convert.lab.xyz = function (lab) {
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
484
|
+
var l = lab[0];
|
|
485
|
+
var a = lab[1];
|
|
486
|
+
var b = lab[2];
|
|
487
|
+
var x;
|
|
488
|
+
var y;
|
|
489
|
+
var z;
|
|
469
490
|
|
|
470
491
|
y = (l + 16) / 116;
|
|
471
492
|
x = a / 500 + y;
|
|
472
493
|
z = y - b / 200;
|
|
473
494
|
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
495
|
+
var y2 = Math.pow(y, 3);
|
|
496
|
+
var x2 = Math.pow(x, 3);
|
|
497
|
+
var z2 = Math.pow(z, 3);
|
|
477
498
|
y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
|
|
478
499
|
x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
|
|
479
500
|
z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
|
|
@@ -486,38 +507,45 @@ convert.lab.xyz = function (lab) {
|
|
|
486
507
|
};
|
|
487
508
|
|
|
488
509
|
convert.lab.lch = function (lab) {
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
510
|
+
var l = lab[0];
|
|
511
|
+
var a = lab[1];
|
|
512
|
+
var b = lab[2];
|
|
513
|
+
var hr;
|
|
514
|
+
var h;
|
|
515
|
+
var c;
|
|
516
|
+
|
|
517
|
+
hr = Math.atan2(b, a);
|
|
495
518
|
h = hr * 360 / 2 / Math.PI;
|
|
496
519
|
|
|
497
520
|
if (h < 0) {
|
|
498
521
|
h += 360;
|
|
499
522
|
}
|
|
500
523
|
|
|
501
|
-
|
|
524
|
+
c = Math.sqrt(a * a + b * b);
|
|
502
525
|
|
|
503
526
|
return [l, c, h];
|
|
504
527
|
};
|
|
505
528
|
|
|
506
529
|
convert.lch.lab = function (lch) {
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
530
|
+
var l = lch[0];
|
|
531
|
+
var c = lch[1];
|
|
532
|
+
var h = lch[2];
|
|
533
|
+
var a;
|
|
534
|
+
var b;
|
|
535
|
+
var hr;
|
|
510
536
|
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
537
|
+
hr = h / 360 * 2 * Math.PI;
|
|
538
|
+
a = c * Math.cos(hr);
|
|
539
|
+
b = c * Math.sin(hr);
|
|
514
540
|
|
|
515
541
|
return [l, a, b];
|
|
516
542
|
};
|
|
517
543
|
|
|
518
|
-
convert.rgb.ansi16 = function (args
|
|
519
|
-
|
|
520
|
-
|
|
544
|
+
convert.rgb.ansi16 = function (args) {
|
|
545
|
+
var r = args[0];
|
|
546
|
+
var g = args[1];
|
|
547
|
+
var b = args[2];
|
|
548
|
+
var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2]; // hsv -> ansi16 optimization
|
|
521
549
|
|
|
522
550
|
value = Math.round(value / 50);
|
|
523
551
|
|
|
@@ -525,7 +553,7 @@ convert.rgb.ansi16 = function (args, saturation = null) {
|
|
|
525
553
|
return 30;
|
|
526
554
|
}
|
|
527
555
|
|
|
528
|
-
|
|
556
|
+
var ansi = 30
|
|
529
557
|
+ ((Math.round(b / 255) << 2)
|
|
530
558
|
| (Math.round(g / 255) << 1)
|
|
531
559
|
| Math.round(r / 255));
|
|
@@ -538,17 +566,17 @@ convert.rgb.ansi16 = function (args, saturation = null) {
|
|
|
538
566
|
};
|
|
539
567
|
|
|
540
568
|
convert.hsv.ansi16 = function (args) {
|
|
541
|
-
//
|
|
569
|
+
// optimization here; we already know the value and don't need to get
|
|
542
570
|
// it converted for us.
|
|
543
571
|
return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
|
|
544
572
|
};
|
|
545
573
|
|
|
546
574
|
convert.rgb.ansi256 = function (args) {
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
575
|
+
var r = args[0];
|
|
576
|
+
var g = args[1];
|
|
577
|
+
var b = args[2];
|
|
550
578
|
|
|
551
|
-
//
|
|
579
|
+
// we use the extended greyscale palette here, with the exception of
|
|
552
580
|
// black and white. normal palette only has 4 greyscale shades.
|
|
553
581
|
if (r === g && g === b) {
|
|
554
582
|
if (r < 8) {
|
|
@@ -562,7 +590,7 @@ convert.rgb.ansi256 = function (args) {
|
|
|
562
590
|
return Math.round(((r - 8) / 247) * 24) + 232;
|
|
563
591
|
}
|
|
564
592
|
|
|
565
|
-
|
|
593
|
+
var ansi = 16
|
|
566
594
|
+ (36 * Math.round(r / 255 * 5))
|
|
567
595
|
+ (6 * Math.round(g / 255 * 5))
|
|
568
596
|
+ Math.round(b / 255 * 5);
|
|
@@ -571,9 +599,9 @@ convert.rgb.ansi256 = function (args) {
|
|
|
571
599
|
};
|
|
572
600
|
|
|
573
601
|
convert.ansi16.rgb = function (args) {
|
|
574
|
-
|
|
602
|
+
var color = args % 10;
|
|
575
603
|
|
|
576
|
-
//
|
|
604
|
+
// handle greyscale
|
|
577
605
|
if (color === 0 || color === 7) {
|
|
578
606
|
if (args > 50) {
|
|
579
607
|
color += 3.5;
|
|
@@ -584,71 +612,71 @@ convert.ansi16.rgb = function (args) {
|
|
|
584
612
|
return [color, color, color];
|
|
585
613
|
}
|
|
586
614
|
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
615
|
+
var mult = (~~(args > 50) + 1) * 0.5;
|
|
616
|
+
var r = ((color & 1) * mult) * 255;
|
|
617
|
+
var g = (((color >> 1) & 1) * mult) * 255;
|
|
618
|
+
var b = (((color >> 2) & 1) * mult) * 255;
|
|
591
619
|
|
|
592
620
|
return [r, g, b];
|
|
593
621
|
};
|
|
594
622
|
|
|
595
623
|
convert.ansi256.rgb = function (args) {
|
|
596
|
-
//
|
|
624
|
+
// handle greyscale
|
|
597
625
|
if (args >= 232) {
|
|
598
|
-
|
|
626
|
+
var c = (args - 232) * 10 + 8;
|
|
599
627
|
return [c, c, c];
|
|
600
628
|
}
|
|
601
629
|
|
|
602
630
|
args -= 16;
|
|
603
631
|
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
632
|
+
var rem;
|
|
633
|
+
var r = Math.floor(args / 36) / 5 * 255;
|
|
634
|
+
var g = Math.floor((rem = args % 36) / 6) / 5 * 255;
|
|
635
|
+
var b = (rem % 6) / 5 * 255;
|
|
608
636
|
|
|
609
637
|
return [r, g, b];
|
|
610
638
|
};
|
|
611
639
|
|
|
612
640
|
convert.rgb.hex = function (args) {
|
|
613
|
-
|
|
641
|
+
var integer = ((Math.round(args[0]) & 0xFF) << 16)
|
|
614
642
|
+ ((Math.round(args[1]) & 0xFF) << 8)
|
|
615
643
|
+ (Math.round(args[2]) & 0xFF);
|
|
616
644
|
|
|
617
|
-
|
|
645
|
+
var string = integer.toString(16).toUpperCase();
|
|
618
646
|
return '000000'.substring(string.length) + string;
|
|
619
647
|
};
|
|
620
648
|
|
|
621
649
|
convert.hex.rgb = function (args) {
|
|
622
|
-
|
|
650
|
+
var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
|
|
623
651
|
if (!match) {
|
|
624
652
|
return [0, 0, 0];
|
|
625
653
|
}
|
|
626
654
|
|
|
627
|
-
|
|
655
|
+
var colorString = match[0];
|
|
628
656
|
|
|
629
657
|
if (match[0].length === 3) {
|
|
630
|
-
colorString = colorString.split('').map(char
|
|
658
|
+
colorString = colorString.split('').map(function (char) {
|
|
631
659
|
return char + char;
|
|
632
660
|
}).join('');
|
|
633
661
|
}
|
|
634
662
|
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
663
|
+
var integer = parseInt(colorString, 16);
|
|
664
|
+
var r = (integer >> 16) & 0xFF;
|
|
665
|
+
var g = (integer >> 8) & 0xFF;
|
|
666
|
+
var b = integer & 0xFF;
|
|
639
667
|
|
|
640
668
|
return [r, g, b];
|
|
641
669
|
};
|
|
642
670
|
|
|
643
671
|
convert.rgb.hcg = function (rgb) {
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
672
|
+
var r = rgb[0] / 255;
|
|
673
|
+
var g = rgb[1] / 255;
|
|
674
|
+
var b = rgb[2] / 255;
|
|
675
|
+
var max = Math.max(Math.max(r, g), b);
|
|
676
|
+
var min = Math.min(Math.min(r, g), b);
|
|
677
|
+
var chroma = (max - min);
|
|
678
|
+
var grayscale;
|
|
679
|
+
var hue;
|
|
652
680
|
|
|
653
681
|
if (chroma < 1) {
|
|
654
682
|
grayscale = min / (1 - chroma);
|
|
@@ -665,7 +693,7 @@ convert.rgb.hcg = function (rgb) {
|
|
|
665
693
|
if (max === g) {
|
|
666
694
|
hue = 2 + (b - r) / chroma;
|
|
667
695
|
} else {
|
|
668
|
-
hue = 4 + (r - g) / chroma;
|
|
696
|
+
hue = 4 + (r - g) / chroma + 4;
|
|
669
697
|
}
|
|
670
698
|
|
|
671
699
|
hue /= 6;
|
|
@@ -675,12 +703,17 @@ convert.rgb.hcg = function (rgb) {
|
|
|
675
703
|
};
|
|
676
704
|
|
|
677
705
|
convert.hsl.hcg = function (hsl) {
|
|
678
|
-
|
|
679
|
-
|
|
706
|
+
var s = hsl[1] / 100;
|
|
707
|
+
var l = hsl[2] / 100;
|
|
708
|
+
var c = 1;
|
|
709
|
+
var f = 0;
|
|
680
710
|
|
|
681
|
-
|
|
711
|
+
if (l < 0.5) {
|
|
712
|
+
c = 2.0 * s * l;
|
|
713
|
+
} else {
|
|
714
|
+
c = 2.0 * s * (1.0 - l);
|
|
715
|
+
}
|
|
682
716
|
|
|
683
|
-
let f = 0;
|
|
684
717
|
if (c < 1.0) {
|
|
685
718
|
f = (l - 0.5 * c) / (1.0 - c);
|
|
686
719
|
}
|
|
@@ -689,11 +722,11 @@ convert.hsl.hcg = function (hsl) {
|
|
|
689
722
|
};
|
|
690
723
|
|
|
691
724
|
convert.hsv.hcg = function (hsv) {
|
|
692
|
-
|
|
693
|
-
|
|
725
|
+
var s = hsv[1] / 100;
|
|
726
|
+
var v = hsv[2] / 100;
|
|
694
727
|
|
|
695
|
-
|
|
696
|
-
|
|
728
|
+
var c = s * v;
|
|
729
|
+
var f = 0;
|
|
697
730
|
|
|
698
731
|
if (c < 1.0) {
|
|
699
732
|
f = (v - c) / (1 - c);
|
|
@@ -703,21 +736,20 @@ convert.hsv.hcg = function (hsv) {
|
|
|
703
736
|
};
|
|
704
737
|
|
|
705
738
|
convert.hcg.rgb = function (hcg) {
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
739
|
+
var h = hcg[0] / 360;
|
|
740
|
+
var c = hcg[1] / 100;
|
|
741
|
+
var g = hcg[2] / 100;
|
|
709
742
|
|
|
710
743
|
if (c === 0.0) {
|
|
711
744
|
return [g * 255, g * 255, g * 255];
|
|
712
745
|
}
|
|
713
746
|
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
747
|
+
var pure = [0, 0, 0];
|
|
748
|
+
var hi = (h % 1) * 6;
|
|
749
|
+
var v = hi % 1;
|
|
750
|
+
var w = 1 - v;
|
|
751
|
+
var mg = 0;
|
|
719
752
|
|
|
720
|
-
/* eslint-disable max-statements-per-line */
|
|
721
753
|
switch (Math.floor(hi)) {
|
|
722
754
|
case 0:
|
|
723
755
|
pure[0] = 1; pure[1] = v; pure[2] = 0; break;
|
|
@@ -732,7 +764,6 @@ convert.hcg.rgb = function (hcg) {
|
|
|
732
764
|
default:
|
|
733
765
|
pure[0] = 1; pure[1] = 0; pure[2] = w;
|
|
734
766
|
}
|
|
735
|
-
/* eslint-enable max-statements-per-line */
|
|
736
767
|
|
|
737
768
|
mg = (1.0 - c) * g;
|
|
738
769
|
|
|
@@ -744,11 +775,11 @@ convert.hcg.rgb = function (hcg) {
|
|
|
744
775
|
};
|
|
745
776
|
|
|
746
777
|
convert.hcg.hsv = function (hcg) {
|
|
747
|
-
|
|
748
|
-
|
|
778
|
+
var c = hcg[1] / 100;
|
|
779
|
+
var g = hcg[2] / 100;
|
|
749
780
|
|
|
750
|
-
|
|
751
|
-
|
|
781
|
+
var v = c + g * (1.0 - c);
|
|
782
|
+
var f = 0;
|
|
752
783
|
|
|
753
784
|
if (v > 0.0) {
|
|
754
785
|
f = c / v;
|
|
@@ -758,11 +789,11 @@ convert.hcg.hsv = function (hcg) {
|
|
|
758
789
|
};
|
|
759
790
|
|
|
760
791
|
convert.hcg.hsl = function (hcg) {
|
|
761
|
-
|
|
762
|
-
|
|
792
|
+
var c = hcg[1] / 100;
|
|
793
|
+
var g = hcg[2] / 100;
|
|
763
794
|
|
|
764
|
-
|
|
765
|
-
|
|
795
|
+
var l = g * (1.0 - c) + 0.5 * c;
|
|
796
|
+
var s = 0;
|
|
766
797
|
|
|
767
798
|
if (l > 0.0 && l < 0.5) {
|
|
768
799
|
s = c / (2 * l);
|
|
@@ -775,18 +806,18 @@ convert.hcg.hsl = function (hcg) {
|
|
|
775
806
|
};
|
|
776
807
|
|
|
777
808
|
convert.hcg.hwb = function (hcg) {
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
809
|
+
var c = hcg[1] / 100;
|
|
810
|
+
var g = hcg[2] / 100;
|
|
811
|
+
var v = c + g * (1.0 - c);
|
|
781
812
|
return [hcg[0], (v - c) * 100, (1 - v) * 100];
|
|
782
813
|
};
|
|
783
814
|
|
|
784
815
|
convert.hwb.hcg = function (hwb) {
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
816
|
+
var w = hwb[1] / 100;
|
|
817
|
+
var b = hwb[2] / 100;
|
|
818
|
+
var v = 1 - b;
|
|
819
|
+
var c = v - w;
|
|
820
|
+
var g = 0;
|
|
790
821
|
|
|
791
822
|
if (c < 1) {
|
|
792
823
|
g = (v - c) / (1 - c);
|
|
@@ -807,12 +838,10 @@ convert.gray.rgb = function (args) {
|
|
|
807
838
|
return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
|
|
808
839
|
};
|
|
809
840
|
|
|
810
|
-
convert.gray.hsl = function (args) {
|
|
841
|
+
convert.gray.hsl = convert.gray.hsv = function (args) {
|
|
811
842
|
return [0, 0, args[0]];
|
|
812
843
|
};
|
|
813
844
|
|
|
814
|
-
convert.gray.hsv = convert.gray.hsl;
|
|
815
|
-
|
|
816
845
|
convert.gray.hwb = function (gray) {
|
|
817
846
|
return [0, 100, gray[0]];
|
|
818
847
|
};
|
|
@@ -826,14 +855,14 @@ convert.gray.lab = function (gray) {
|
|
|
826
855
|
};
|
|
827
856
|
|
|
828
857
|
convert.gray.hex = function (gray) {
|
|
829
|
-
|
|
830
|
-
|
|
858
|
+
var val = Math.round(gray[0] / 100 * 255) & 0xFF;
|
|
859
|
+
var integer = (val << 16) + (val << 8) + val;
|
|
831
860
|
|
|
832
|
-
|
|
861
|
+
var string = integer.toString(16).toUpperCase();
|
|
833
862
|
return '000000'.substring(string.length) + string;
|
|
834
863
|
};
|
|
835
864
|
|
|
836
865
|
convert.rgb.gray = function (rgb) {
|
|
837
|
-
|
|
866
|
+
var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
|
|
838
867
|
return [val / 255 * 100];
|
|
839
868
|
};
|