{"_id":"gray-percentage","_rev":"270810","name":"gray-percentage","description":"Convenience function to get a gray value by percentage e.g. gray(60) -> hsla(0,0%,100%,0.4)","dist-tags":{"latest":"2.0.0"},"maintainers":[{"name":"kylemathews","email":""}],"time":{"modified":"2021-06-03T17:22:27.000Z","created":"2015-03-04T18:02:42.082Z","2.0.0":"2016-08-16T17:58:21.184Z","1.1.2":"2015-03-31T00:28:54.146Z","1.1.1":"2015-03-31T00:18:46.748Z","1.1.0":"2015-03-30T23:25:53.354Z","1.0.2":"2015-03-06T02:12:26.393Z","1.0.1":"2015-03-04T18:04:24.560Z","1.0.0":"2015-03-04T18:02:42.082Z"},"users":{},"author":{"name":"Kyle Mathews","email":"mathews.kyle@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/KyleAMathews/gray-percentage.git"},"versions":{"2.0.0":{"name":"gray-percentage","description":"Convenience function to get a gray value by percentage e.g. gray(60) -> hsla(0,0%,100%,0.4)","version":"2.0.0","author":{"name":"Kyle Mathews","email":"mathews.kyle@gmail.com"},"bugs":{"url":"https://github.com/KyleAMathews/gray-percentage/issues"},"homepage":"https://github.com/KyleAMathews/gray-percentage","keywords":["colors","css","gray","grey"],"license":"MIT","main":"index.js","repository":{"type":"git","url":"git+https://github.com/KyleAMathews/gray-percentage.git"},"scripts":{"test-watch":"NODE_ENV=test node_modules/.bin/mocha -w --recursive --compilers coffee:coffee-script/register -R mocha-unfunk-reporter","test":"jshint *.json *.js & NODE_ENV=test node_modules/.bin/mocha --recursive --compilers coffee:coffee-script/register -R mocha-unfunk-reporter"},"devDependencies":{"chai":"^2.1.0","coffee-script":"^1.9.1","mocha":"^2.1.0","mocha-unfunk-reporter":"^0.4.0","pre-commit":"^1.0.5"},"gitHead":"e7d5594cf15f39b9010f52bce6471d83c5012494","_id":"gray-percentage@2.0.0","_shasum":"b72a274d1b1379104a0050b63b207dc53fe56f99","_from":".","_npmVersion":"3.10.5","_nodeVersion":"6.2.2","_npmUser":{"name":"kylemathews","email":"mathews.kyle@gmail.com"},"maintainers":[{"name":"kylemathews","email":""}],"dist":{"shasum":"b72a274d1b1379104a0050b63b207dc53fe56f99","size":39269,"noattachment":false,"key":"/gray-percentage/-/gray-percentage-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/gray-percentage/download/gray-percentage-2.0.0.tgz"},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/gray-percentage-2.0.0.tgz_1471370297455_0.664642819436267"},"directories":{},"publish_time":1471370301184,"_cnpm_publish_time":1471370301184,"_hasShrinkwrap":false},"1.1.2":{"name":"gray-percentage","description":"Convenience function to get a gray value by percentage e.g. gray(60) -> rgb(153,153,153)","version":"1.1.2","author":{"name":"Kyle Mathews","email":"mathews.kyle@gmail.com"},"bugs":{"url":"https://github.com/KyleAMathews/gray-percentage/issues"},"homepage":"https://github.com/KyleAMathews/gray-percentage","keywords":["colors","css","gray","grey"],"license":"MIT","main":"index.js","repository":{"type":"git","url":"https://github.com/KyleAMathews/gray-percentage.git"},"scripts":{"test-watch":"NODE_ENV=test node_modules/.bin/mocha -w --recursive --compilers coffee:coffee-script/register -R mocha-unfunk-reporter","test":"jshint *.json *.js & NODE_ENV=test node_modules/.bin/mocha --recursive --compilers coffee:coffee-script/register -R mocha-unfunk-reporter"},"devDependencies":{"chai":"^2.1.0","coffee-script":"^1.9.1","mocha":"^2.1.0","mocha-unfunk-reporter":"^0.4.0","pre-commit":"^1.0.5"},"gitHead":"9c5164a090be2f24231a5f725f5afad90885b32b","_id":"gray-percentage@1.1.2","_shasum":"76fc4c1fb95e5c64d9a43c47b4c10263908f81c3","_from":".","_npmVersion":"2.6.1","_nodeVersion":"0.10.35","_npmUser":{"name":"kylemathews","email":"mathews.kyle@gmail.com"},"maintainers":[{"name":"kylemathews","email":""}],"dist":{"shasum":"76fc4c1fb95e5c64d9a43c47b4c10263908f81c3","size":30733,"noattachment":false,"key":"/gray-percentage/-/gray-percentage-1.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/gray-percentage/download/gray-percentage-1.1.2.tgz"},"directories":{},"publish_time":1427761734146,"_cnpm_publish_time":1427761734146,"_hasShrinkwrap":false},"1.1.1":{"name":"gray-percentage","description":"Convenience function to get a gray value by percentage e.g. gray(60) -> rgb(153,153,153)","version":"1.1.1","author":{"name":"Kyle Mathews","email":"mathews.kyle@gmail.com"},"bugs":{"url":"https://github.com/KyleAMathews/gray-percentage/issues"},"homepage":"https://github.com/KyleAMathews/gray-percentage","keywords":["colors","css","gray","grey"],"license":"MIT","main":"index.js","repository":{"type":"git","url":"https://github.com/KyleAMathews/gray-percentage.git"},"scripts":{"test-watch":"NODE_ENV=test node_modules/.bin/mocha -w --recursive --compilers coffee:coffee-script/register -R mocha-unfunk-reporter","test":"jshint *.json *.js & NODE_ENV=test node_modules/.bin/mocha --recursive --compilers coffee:coffee-script/register -R mocha-unfunk-reporter"},"devDependencies":{"chai":"^2.1.0","coffee-script":"^1.9.1","mocha":"^2.1.0","mocha-unfunk-reporter":"^0.4.0","pre-commit":"^1.0.5"},"gitHead":"b623db10a1bebcbf848124a1501fbb31fafab44a","_id":"gray-percentage@1.1.1","_shasum":"fe35b15812489d3a011f306e8790dc62b7b20f0c","_from":".","_npmVersion":"2.6.1","_nodeVersion":"0.10.35","_npmUser":{"name":"kylemathews","email":"mathews.kyle@gmail.com"},"maintainers":[{"name":"kylemathews","email":""}],"dist":{"shasum":"fe35b15812489d3a011f306e8790dc62b7b20f0c","size":12432,"noattachment":false,"key":"/gray-percentage/-/gray-percentage-1.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/gray-percentage/download/gray-percentage-1.1.1.tgz"},"directories":{},"publish_time":1427761126748,"_cnpm_publish_time":1427761126748,"_hasShrinkwrap":false},"1.1.0":{"name":"gray-percentage","description":"Convenience function to get a gray value by percentage e.g. gray(60) -> rgb(153,153,153)","version":"1.1.0","author":{"name":"Kyle Mathews","email":"mathews.kyle@gmail.com"},"bugs":{"url":"https://github.com/KyleAMathews/gray-percentage/issues"},"homepage":"https://github.com/KyleAMathews/gray-percentage","keywords":["colors","css","gray","grey"],"license":"MIT","main":"index.js","repository":{"type":"git","url":"https://github.com/KyleAMathews/gray-percentage.git"},"scripts":{"test-watch":"NODE_ENV=test node_modules/.bin/mocha -w --recursive --compilers coffee:coffee-script/register -R mocha-unfunk-reporter","test":"jshint *.json *.js & NODE_ENV=test node_modules/.bin/mocha --recursive --compilers coffee:coffee-script/register -R mocha-unfunk-reporter"},"devDependencies":{"chai":"^2.1.0","coffee-script":"^1.9.1","mocha":"^2.1.0","mocha-unfunk-reporter":"^0.4.0","pre-commit":"^1.0.5"},"gitHead":"d5704fe8fa3178de9d4f4a379a9854721ea6f4ba","_id":"gray-percentage@1.1.0","_shasum":"33cef1e2b3acda3adfd44c8133bf7bd8b81da7ac","_from":".","_npmVersion":"2.6.1","_nodeVersion":"0.10.35","_npmUser":{"name":"kylemathews","email":"mathews.kyle@gmail.com"},"maintainers":[{"name":"kylemathews","email":""}],"dist":{"shasum":"33cef1e2b3acda3adfd44c8133bf7bd8b81da7ac","size":12118,"noattachment":false,"key":"/gray-percentage/-/gray-percentage-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/gray-percentage/download/gray-percentage-1.1.0.tgz"},"directories":{},"publish_time":1427757953354,"_cnpm_publish_time":1427757953354,"_hasShrinkwrap":false},"1.0.2":{"name":"gray-percentage","description":"Convenience function to get a gray value by percentage e.g. gray(60) -> rgb(153,153,153)","version":"1.0.2","author":{"name":"Kyle Mathews","email":"mathews.kyle@gmail.com"},"bugs":{"url":"https://github.com/KyleAMathews/gray-percentage/issues"},"homepage":"https://github.com/KyleAMathews/gray-percentage","keywords":["colors","css","gray","grey"],"license":"MIT","main":"index.js","repository":{"type":"git","url":"https://github.com/KyleAMathews/gray-percentage.git"},"scripts":{"test-watch":"NODE_ENV=test node_modules/.bin/mocha -w --recursive --compilers coffee:coffee-script/register -R mocha-unfunk-reporter","test":"jshint *.json *.js & NODE_ENV=test node_modules/.bin/mocha --recursive --compilers coffee:coffee-script/register -R mocha-unfunk-reporter"},"devDependencies":{"chai":"^2.1.0","coffee-script":"^1.9.1","mocha":"^2.1.0","mocha-unfunk-reporter":"^0.4.0","pre-commit":"^1.0.5"},"gitHead":"793589d85c07201180b90f6b44d155687a707e5a","_id":"gray-percentage@1.0.2","_shasum":"075b889ac7844ca34082441f1f05d0ada18d2433","_from":".","_npmVersion":"2.6.1","_nodeVersion":"0.10.35","_npmUser":{"name":"kylemathews","email":"mathews.kyle@gmail.com"},"maintainers":[{"name":"kylemathews","email":""}],"dist":{"shasum":"075b889ac7844ca34082441f1f05d0ada18d2433","size":5999,"noattachment":false,"key":"/gray-percentage/-/gray-percentage-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/gray-percentage/download/gray-percentage-1.0.2.tgz"},"directories":{},"publish_time":1425607946393,"_cnpm_publish_time":1425607946393,"_hasShrinkwrap":false},"1.0.1":{"name":"gray-percentage","description":"Convenience function to get a gray value by percentage e.g. gray(60) -> rgb(153,153,153)","version":"1.0.1","author":{"name":"Kyle Mathews","email":"mathews.kyle@gmail.com"},"bugs":{"url":"https://github.com/KyleAMathews/gray-percentage/issues"},"homepage":"https://github.com/KyleAMathews/gray-percentage","keywords":["colors","css","gray","grey"],"license":"MIT","main":"index.js","repository":{"type":"git","url":"https://github.com/KyleAMathews/gray-percentage.git"},"scripts":{"test-watch":"NODE_ENV=test node_modules/.bin/mocha -w --recursive --compilers coffee:coffee-script/register -R mocha-unfunk-reporter","test":"jshint *.json *.js & NODE_ENV=test node_modules/.bin/mocha --recursive --compilers coffee:coffee-script/register -R mocha-unfunk-reporter"},"devDependencies":{"chai":"^2.1.0","coffee-script":"^1.9.1","mocha":"^2.1.0","mocha-unfunk-reporter":"^0.4.0","pre-commit":"^1.0.5"},"gitHead":"5273d2e6ef95ad26500fcfb3bfa8d3a4e93f954c","_id":"gray-percentage@1.0.1","_shasum":"e5b8247fef8e38b519fe349dc07302e7e016c8f5","_from":".","_npmVersion":"2.6.1","_nodeVersion":"0.10.35","_npmUser":{"name":"kylemathews","email":"mathews.kyle@gmail.com"},"maintainers":[{"name":"kylemathews","email":""}],"dist":{"shasum":"e5b8247fef8e38b519fe349dc07302e7e016c8f5","size":5435,"noattachment":false,"key":"/gray-percentage/-/gray-percentage-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/gray-percentage/download/gray-percentage-1.0.1.tgz"},"directories":{},"publish_time":1425492264560,"_cnpm_publish_time":1425492264560,"_hasShrinkwrap":false},"1.0.0":{"name":"gray-percentage","description":"Convenience function to get a gray value by percentage e.g. gray(60) -> #999999","version":"1.0.0","author":{"name":"Kyle Mathews","email":"mathews.kyle@gmail.com"},"bugs":{"url":"https://github.com/KyleAMathews/gray-percentage/issues"},"homepage":"https://github.com/KyleAMathews/gray-percentage","keywords":["colors","css","gray","grey"],"license":"MIT","main":"index.js","repository":{"type":"git","url":"https://github.com/KyleAMathews/gray-percentage.git"},"scripts":{"test-watch":"NODE_ENV=test node_modules/.bin/mocha -w --recursive --compilers coffee:coffee-script/register -R mocha-unfunk-reporter","test":"jshint *.json *.js & NODE_ENV=test node_modules/.bin/mocha --recursive --compilers coffee:coffee-script/register -R mocha-unfunk-reporter"},"devDependencies":{"chai":"^2.1.0","coffee-script":"^1.9.1","mocha":"^2.1.0","mocha-unfunk-reporter":"^0.4.0","pre-commit":"^1.0.5"},"gitHead":"ffd2e526246b400f603d1ce9871a2f761ccdc9fa","_id":"gray-percentage@1.0.0","_shasum":"cdb9f8406ecf0bc04584fff0d8614a22b5ad9816","_from":".","_npmVersion":"2.6.1","_nodeVersion":"0.10.35","_npmUser":{"name":"kylemathews","email":"mathews.kyle@gmail.com"},"maintainers":[{"name":"kylemathews","email":""}],"dist":{"shasum":"cdb9f8406ecf0bc04584fff0d8614a22b5ad9816","size":5395,"noattachment":false,"key":"/gray-percentage/-/gray-percentage-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/gray-percentage/download/gray-percentage-1.0.0.tgz"},"directories":{},"publish_time":1425492162082,"_cnpm_publish_time":1425492162082,"_hasShrinkwrap":false}},"readme":"# gray-percentage\nConvenience function to get a gray value by percentage e.g. gray(60) ->\n\"hsla(0,0%,100%, 0.4)\"\n\nThe function takes a required \"lightness\" value from 0-100 and an\noptional second parameter to mixin color to the gray value. The second\nparameter can either be a \"hue\" value from 0-360 or one of three named\nhues, \"cool\", \"slate\", and \"warm\".\n\nAs suggested by [Google Material\nDesign](https://material.google.com/style/color.html#color-text-background-colors)\nwe color lightness using opacity instead of gray values. Quoting Google:\n\"Black or white text that is transparent remains legible and vibrant\nagainst background color changes. This makes it more flexible than grey\ntext in the same contexts.\"\n\nWe assume when picking the opacity/lightness that the background is\nlight. If, for example, you have dark background with light text, set\nthe third paramter, `darkBackground` to true e.g. `gray(80, 0, true)`.\n\nWe use color theory to choose an appropriate saturation value. Basically\nthe darker the gray, the higher the saturation value that is choosen.\nThis article was very helpful in picking appropriate saturation values\nhttp://ianstormtaylor.com/design-tip-never-use-black/\n\nThe following is the curve that choose saturation values and is used\n[here in the code](https://github.com/KyleAMathews/gray-percentage/blob/239cc2d4e972b778f23f26c3b677f91e9487c803/index.js#L37-L42).\n\n![screen shot 2016-06-08 at 10 08 11 am](https://cloud.githubusercontent.com/assets/71047/15903355/2ce29a6c-2d61-11e6-9f17-d273e8e76e10.png)\n\n## Install\n`npm install gray-percentage`\n\n## Usage\n\n```javascript\nvar gray = require('gray-percentage');\n\nvar textColor = gray(30);\n// textColor = \"hsla(0,0%,100%,0.7)\"\n\n// Get a \"cool\" gray.\nvar background = gray(93, \"cool\")\n// background = \"hsla(237,0.9935851860000025%,100%,0.07)\"\n\n// Mixin arbitrary hues e.g. Red.\nvar sidebarBg = gray(15, 360)\n// sidebarBg = \"hsla(360,14.84301465%,100%,0.85)\"\n\n// Get color for dark background\nvar lightGray = gray(85, 0, true)\n// lightGray = \"hsla(0, 0%, 100%, 0.85)\"\n```\n","_attachments":{},"homepage":"https://github.com/KyleAMathews/gray-percentage","bugs":{"url":"https://github.com/KyleAMathews/gray-percentage/issues"},"license":"MIT"}