UNPKG

@warriorjs/cli

Version:

WarriorJS command line

29 lines (22 loc) 729 B
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _chalk = require('chalk'); var _chalk2 = _interopRequireDefault(_chalk); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } // Downsample colors from RGB to 256 color ANSI for greater uniformity. const ctx = new _chalk2.default.constructor({ level: 2 }); /** * Returns the style for the given unit. * * @param {Object} unit The unit to get the style for. * @param {string} unit.color The color of the unit (hex). * * @returns {Function} The style function. */ function getUnitStyle({ color }) { return ctx.hex(color); } exports.default = getUnitStyle; module.exports = exports.default;