{"_id":"safe-chalk","_rev":"6-5d142dde20b43b242881425372bbc6b0","name":"safe-chalk","dist-tags":{"latest":"1.0.4"},"versions":{"1.0.0":{"name":"safe-chalk","version":"1.0.0","author":{"name":"DavidWells"},"license":"MIT","_id":"safe-chalk@1.0.0","maintainers":[{"name":"davidwells","email":"davidgregorywells@gmail.com"}],"dist":{"shasum":"e40f1bdddd7743ca29bad54ced53461607eabcd4","tarball":"https://registry.npmjs.org/safe-chalk/-/safe-chalk-1.0.0.tgz","fileCount":5,"integrity":"sha512-trAgf+c4FD2hK6Yuj7zGrnVMl53WUkCYwvqfmMcU6kz0Jo/UydFNd9WTo3xV7CDB9Vzn6YydPGsFa3FFDB9q6Q==","signatures":[{"sig":"MEUCIQCNrOvg8UyKiFYeAGSNzaOyJt+yMd85CR6SkqvxWiq3DgIgfE3NE8Cc0gDrHKVnq5OkVpVWrfc1IrIKeHNmxklMuFI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":12299,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfhiWVCRA9TVsSAnZWagAAwJ0P/ih/pL0Ik79tXToKhG7i\nX+SSFsdeVGUCFmwV/2hc0sZBn3a7BPUvXERSe9Mc1PxCpo2xImaSQTF2tk9p\nt305N8C17Ss9Gbomgq4V1PFc0BY6kwUmuUQluiVET3XbkO1x69sozzsGhpGn\nRdMIhZhfCZsw2hN5w6IeH5EReIV4CMVMxAKnM9jBCYXr5QwL+GgVH5uL+25m\nWIVD+lDhbs5bZ0icPt2fP5zbj5Aqp+aPXI3oH0nQjzsrg8uoISsvk0o7RjHN\nmi0nHvyqonWcVV8wsFKvn2gvtBAFYBhtoxVW5/bK6QZgyMFlUxCPh2bE/PDb\nSZem9uqZs2PlZWFB7gWvMa67uRNV6w2dAyhPMWn4SjV3l+cjI7n+QjMKmlIG\nkr5bScqRCGnf0v8Qi3AqrvMvzuv9Z7kWDyl3uHIUAbVNWotOP7JHtrjkK/NW\nscOK2XkD/GsvtxekQVlC4RqR+oDzNsXOi7hejg4rIYSNYTnh1FLbf6VPTt8x\nI2yPe33zaE+QQ8K4ZgCeXzH1LM6dWvcyyMBqDzsplntnmgrtAY85zRmPUEgx\nPM3FGywTsSzfG5YDEJAlCRBn/lGoRAwGHb3Cu4Xd/CNGfsjnjbgMThMw8FUL\nCwD5FS4i1SfGtL6G5I2y8pI6rtitD+oi+sxW51+2FpIlAYkHIbYn1TumoXMS\npDM1\r\n=8I8k\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src","gitHead":"8c6bde42c92fe266a27e631eb43ce07d6f717bf3","scripts":{"test":"echo \"Error: no test specified\" && exit 1","publish":"git push origin && git push origin --tags","preversion":"npm run sync-types","sync-types":"cpy node_modules/chalk/index.d.ts ../safe-chalk","release:major":"npm version major && npm publish","release:minor":"npm version minor && npm publish","release:patch":"npm version patch && npm publish"},"_npmUser":{"name":"davidwells","email":"davidgregorywells@gmail.com"},"_npmVersion":"6.10.0","description":"Wrapper for chalk package with easy enable/disable option.","directories":{},"_nodeVersion":"12.7.0","dependencies":{"chalk":"^4.1.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/safe-chalk_1.0.0_1602626964744_0.7989286610385367","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"safe-chalk","version":"1.0.1","author":{"name":"DavidWells"},"license":"MIT","_id":"safe-chalk@1.0.1","maintainers":[{"name":"davidwells","email":"davidgregorywells@gmail.com"}],"dist":{"shasum":"32ee53600d6bb2a4bc936544e5c1da288e9806c0","tarball":"https://registry.npmjs.org/safe-chalk/-/safe-chalk-1.0.1.tgz","fileCount":4,"integrity":"sha512-1DKwry5kAdwQnv3zpfhdDM75/SBkQfsux5i0rtYNr0+NXtpUcvpWOJ3McyFc2jngeBmeWTFEgHNz1Ts0RqOmtw==","signatures":[{"sig":"MEUCIQCAJqbUvUQKKTNndCEQgB+uaIflsBphsn+IfI7oOpD5vwIgYlofdAunTJP8UwGYfTXpDMMjBAViqS8v/OhMFowiWX4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":4132},"main":"src","gitHead":"6c1a3757798b7a82daaab0ff0dd5165421996513","scripts":{"test":"echo \"Error: no test specified\" && exit 1","types":"tsc --emitDeclarationOnly --declaration --outDir types","publish":"git push origin && git push origin --tags","release:major":"npm version major && npm publish","release:minor":"npm version minor && npm publish","release:patch":"npm version patch && npm publish"},"_npmUser":{"name":"davidwells","email":"davidgregorywells@gmail.com"},"_npmVersion":"10.9.0","description":"Wrapper for chalk package with easy enable/disable option.","directories":{},"_nodeVersion":"22.11.0","dependencies":{"chalk":"^4.1.1"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.8.3"},"_npmOperationalInternal":{"tmp":"tmp/safe-chalk_1.0.1_1749263586920_0.6533998682037976","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"safe-chalk","version":"1.0.2","author":{"name":"DavidWells"},"license":"MIT","_id":"safe-chalk@1.0.2","maintainers":[{"name":"davidwells","email":"davidgregorywells@gmail.com"}],"dist":{"shasum":"2313bdc67f4d2387e2694c6881a1262cd7051ba9","tarball":"https://registry.npmjs.org/safe-chalk/-/safe-chalk-1.0.2.tgz","fileCount":4,"integrity":"sha512-9a3Pda1r8WkTun8FrNTcbO0Zm5gzsTjeamtDqmyyru5QtgpAZR3eYeIrkEr79JnHFXpYri0kY9QvjCvhMunRKg==","signatures":[{"sig":"MEUCIQCwyODs4t7un4UKt0L7v4efbXa0b/tObQpcjpviSLay8gIgN+5Vi5USfKKkFdeSppsQUKGn/4Isza9DxryAoe+i7Ko=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":4163},"main":"src","gitHead":"0ec2a878a610b6cc302645bc0b5d8218e51e3e50","scripts":{"test":"echo \"Error: no test specified\" && exit 1","types":"tsc --emitDeclarationOnly --declaration --outDir types","publish":"git push origin && git push origin --tags","release:major":"npm version major && npm publish","release:minor":"npm version minor && npm publish","release:patch":"npm version patch && npm publish"},"_npmUser":{"name":"davidwells","email":"davidgregorywells@gmail.com"},"_npmVersion":"10.9.0","description":"Wrapper for chalk package with easy enable/disable option.","directories":{},"_nodeVersion":"22.11.0","dependencies":{"chalk":"^4.1.1"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.8.3","@types/chalk":"^0.4.31"},"_npmOperationalInternal":{"tmp":"tmp/safe-chalk_1.0.2_1749263990095_0.47995157011755274","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"safe-chalk","version":"1.0.3","author":{"name":"DavidWells"},"license":"MIT","_id":"safe-chalk@1.0.3","maintainers":[{"name":"davidwells","email":"davidgregorywells@gmail.com"}],"dist":{"shasum":"02cb038fd8067c02311f4b011918fa3bcbe3dc7d","tarball":"https://registry.npmjs.org/safe-chalk/-/safe-chalk-1.0.3.tgz","fileCount":14,"integrity":"sha512-s9Lf7QB6Ac1G/ppihao/4qXKc4sOUyMjNjnu2sK1hAyM2CLhNNLgZI6cMkiAEYm1EBX+JCcT7vKc5aq4/TB1Ig==","signatures":[{"sig":"MEYCIQCqfack/LygFd2tEaW2CNkZc037lIQ05xhcs2NCw6ooAAIhAMvBf1n1OUAcKhVJNNx9UE3mn/NKvwVb9i5unllbQR4b","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":6228},"main":"src","types":"types/index.d.ts","gitHead":"5be0aaea12c17fc9e48d775fd1fce2756200d5f5","scripts":{"test":"echo \"Error: no test specified\" && exit 1","types":"tsc --emitDeclarationOnly --declaration --outDir types","publish":"git push origin && git push origin --tags","release:major":"npm version major && npm publish","release:minor":"npm version minor && npm publish","release:patch":"npm version patch && npm publish"},"_npmUser":{"name":"davidwells","email":"davidgregorywells@gmail.com"},"_npmVersion":"10.9.0","description":"Wrapper for chalk package with easy enable/disable option.","directories":{},"_nodeVersion":"22.11.0","dependencies":{"chalk":"^4.1.1"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.8.3","@types/chalk":"^4.1.0"},"_npmOperationalInternal":{"tmp":"tmp/safe-chalk_1.0.3_1749264175723_0.8800182694701486","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"safe-chalk","version":"1.0.4","description":"Wrapper for chalk package with easy enable/disable option.","author":{"name":"DavidWells"},"license":"MIT","main":"src","types":"types/index.d.ts","scripts":{"test":"echo \"Error: no test specified\" && exit 1","publish":"git push origin && git push origin --tags","release:patch":"npm version patch && npm publish","release:minor":"npm version minor && npm publish","release:major":"npm version major && npm publish"},"dependencies":{"chalk":"^4.1.1"},"devDependencies":{"typescript":"^5.8.3"},"_id":"safe-chalk@1.0.4","gitHead":"dd9c8888abfb0b80584801d41df483f4512bfac0","_nodeVersion":"22.11.0","_npmVersion":"10.9.0","dist":{"integrity":"sha512-Mej20c9bM1b95WKYgIT3Ofz2eBKWfV1WHcl3ac0l4yfPM/bkINUBl9Kk9MNSBTO93BZ/+q+NTE1z5q/xKxVzfQ==","shasum":"8f2b1389924df26cc155db19ee070603156fc7ba","tarball":"https://registry.npmjs.org/safe-chalk/-/safe-chalk-1.0.4.tgz","fileCount":5,"unpackedSize":4772,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIEhLOwAucTHSrq5Q3c9V5q9uFNnuz/+ekKLh2RIPP8YwAiBc3nwUy52yoWkkOF3tthoKrJy0zO4+/ngvGtGNz9pK1A=="}]},"_npmUser":{"name":"davidwells","email":"davidgregorywells@gmail.com"},"directories":{},"maintainers":[{"name":"davidwells","email":"davidgregorywells@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/safe-chalk_1.0.4_1764687499548_0.2781610613593479"},"_hasShrinkwrap":false}},"time":{"created":"2020-10-13T22:09:24.744Z","modified":"2025-12-02T14:58:21.537Z","1.0.0":"2020-10-13T22:09:24.905Z","1.0.1":"2025-06-07T02:33:07.132Z","1.0.2":"2025-06-07T02:39:50.293Z","1.0.3":"2025-06-07T02:42:55.904Z","1.0.4":"2025-12-02T14:58:19.737Z"},"author":{"name":"DavidWells"},"license":"MIT","description":"Wrapper for chalk package with easy enable/disable option.","maintainers":[{"name":"davidwells","email":"davidgregorywells@gmail.com"}],"readme":"# Safe Chalk\n\nWrapper for `chalk` package with easy enable/disable option.\n\n## Usage\n\nImport `safe-chalk` set enabled/disabled &\n\n```js\nconst safeChalk = require('safe-chalk')\n\nconsole.log(chalk.red.bold('Hello'))\n/* Normal chalk instance prints red bold \"Hello\" text */\n\n/* In app code conditionally disable ... */\nconst foo = 'bar'\nconst disableColors = (foo === 'bar') ? true : false\nconst chalk = safeChalk(disableColors)\n\nconsole.log(chalk.red.bold('Hello'))\n/* Never-null chalk instance prints \"Hello\" text with no colors */\n```\n\n**Real world example:**\n\n```js\nconst safeChalk = require('safe-chalk')\nconst minimist = require('minimist')\nconst argv = minimist(process.argv.slice(2))\n\n// If --json flag passed disable chalk colors!\nconst DISABLE_COLORS = argv.json || process.env.NO_COLORS\n\n// Export chalk instance for usage in CLI\nmodule.exports = safeChalk(DISABLE_COLORS)\n```\n\nNow if the `--json` flag is passed into the CLI command, chalk colors will be disabled\n\n```bash\nmy-cli --json\n# No colors!\n```\n\n## How it works.\n\nIf chalk is disabled the chalk instance will be wrapped in a never null proxy.\n\nThis means chalk won't throw for chained calls.\n\n## Alternative Approaches\n\n[chalk](https://github.com/chalk/chalk) supports `env` variables `process.env.FORCE_COLOR=0` to disable colors.\n\nIf the `environment` variable works for your use case, use `chalk`.\n\n**Why this package?**\n\nThe env var must be set before chalk is imported, this can be tricky in certain cases. The env variable can also conflict with other packages using chalk.\n","readmeFilename":"README.md"}