egg-colors

colors for egg

Usage no npm install needed!

<script type="module">
  import eggColors from 'https://cdn.skypack.dev/egg-colors';
</script>

README

egg-colors

NPM version build status Test coverage David deps Known Vulnerabilities npm download

Install

$ npm i egg-colors --save

Usage

// {app_root}/config/plugin.js
exports.colors = {
  enable: true,
  package: 'egg-colors',
};

Configuration

// {app_root}/config/config.default.js
exports.colors = {
};

see config/config.default.js for more detail.

Example

# controller/home.js

'use strict';

const Controller = require('egg').Controller;

class HomeController extends Controller {
  async index() {
    const { ctx } = this;
    await ctx.red('1111111111');
    // await ctx.balck('123456');
        // await ctx.red('123456');
        // await ctx.green('123456');
        // await ctx.yellow('123456');
        // await ctx.blue('123456');
        // await ctx.magenta('123456');
        // await ctx.cyan('123456');
        // await ctx.white('123456');
        // await ctx.gray('123456');
        // await ctx.grey('123456');
    ctx.body = 'text';
  }
}

module.exports = HomeController;

Questions & Suggestions

Please open an issue here.

License

MIT