Quick Color Functions for a Node.js CLI

Here are a few functions for adding color to CLI output while respecting the NO_COLOR env variable and a --no-color arg:

const s = (s) => s
const { red, blue, green, grey } =
  process.env.NO_COLOR || process.argv.includes('--no-color')
    ? { red: s, blue: s, green: s, grey: s }
    : {
        red: s => `\u001b[31m${s}\u001b[39m`,
        blue: s => `\u001b[34m${s}\u001b[39m`,
        green: s => `\u001b[32m${s}\u001b[39m`,
        grey: s => `\u001b[90m${s}\u001b[39m`,
      }

from DynamoDB (4.0ms) to HTML (1.4ms) in 5.4ms