How to use the colors.grey function in colors

To help you get started, we’ve selected a few colors examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github codingfriend1 / vue-static / the-magic / boot / entry-server.js View on Github external
router.onReady(() => {
      let matchedComponents = router.getMatchedComponents();

      // no matched routes
      if (!matchedComponents.length) {
        return reject(colors.red(`${context.file.url}`) + colors.grey(` from `) + colors.red(context.file.path.replace(__dirname, '')) + colors.grey(` is not routed to any vue templates. Match a vue template to this url in the ` + colors.green(`site.config.js`) + ` routes.\n\r`)
        );
      }

      /**
       * For every subcomponent for this route, we check if any of them require AJAX requests to be run and completed before we render. This is helpful in the case that you want to fetch some data at the moment the user or Search Engine Bot load the page and embed the results in the rendered HTML file
       * We provide each `asyncData()` function the store and current route in case that information is needed for making the AJAX request
       */
      Promise.all(
        matchedComponents.map(Component => {
          if (Component.options.asyncData) {

            // call `asyncData()` on all matched route components
            return Component.options.asyncData({
              store,
              route: router.currentRoute
            });
github sblaurock / crypticker / index.js View on Github external
priceDataHistory[dataKey] = priceDataHistory[dataKey] || new Array(options.app.history.length).fill(' ');

          if (
            currentLastPrice > previousLastPrice &&
            utility.fixed(currentLastPrice - previousLastPrice, 6) > options.app.history.minorThreshold
          ) {
            // Price has increased since last update and was greater than threshold
            priceDataHistory[dataKey].push(colors.green.bold(symbol));
          } else if (
            currentLastPrice < previousLastPrice &&
            utility.fixed(previousLastPrice - currentLastPrice, 6) > options.app.history.minorThreshold
          ) {
            // Price has decreased since last update and was greater than threshold
            priceDataHistory[dataKey].push(colors.red.bold(symbol));
          } else {
            priceDataHistory[dataKey].push(retrievalError ? ' ' : colors.grey(options.app.history.neutralSymbol));
          }

          historyChangeOutput = currentLastPrice - previousLastPrice;

          // Format history output, set precision based on amount
          if (historyChangeOutput === 0 || options.app.history.hideAmount) {
            historyChangeOutput = '';
          } else if (historyChangeOutput > 0) {
            if (historyChangeOutput >= 1) {
              historyChangeOutput = `+${utility.addCommas(historyChangeOutput.toFixed(2))}`;
            } else {
              historyChangeOutput = `+${utility.fixed(historyChangeOutput, 6)}`;
            }
          } else if (historyChangeOutput <= -1) {
            historyChangeOutput = `${utility.addCommas(historyChangeOutput.toFixed(2))}`;
          } else {
github awslabs / iot-device-simulator / source / simulator / lib / logger.js View on Github external
debug(message, level) {
        if (level <= loggingLevel) {
            console.log(moment.utc().format('YYYY-MM-DD HH:mm:ss'), ' : ', '[debug] ', colors.grey(message));
        }
    }
github jsappme / node-binance-trader / trader.js View on Github external
socket.on('sell_signal', async (signal) => {
    const tresult = _.findIndex(user_payload, (o) => { return o.stratid == signal.stratid })
    if ( (trading_pairs[signal.pair+signal.stratid]) && (tresult > -1) ) {
        console.log(colors.grey('NBT HUB => Sell signal received :: ', signal.stratname, signal.pair))
        trading_pairs[signal.pair+signal.stratid] = false
        const price = await getSellPrice(signal.pair)
        const sell_price = new BigNumber(price)
        const pnl = sell_price.minus(buy_prices[signal.pair+signal.stratid]).times(100).dividedBy(buy_prices[signal.pair+signal.stratid])
        if (user_payload[tresult].trading_type === "real") {
            binance_client.order({
                symbol: signal.pair,
                side: 'SELL',
                quantity: Number(user_payload[tresult].buy_amount),
                type: 'MARKET',
            })
            .then( (order_result) => {
                console.log("SELL ORDER RESULT", signal.pair)
                console.log(order_result)
                if (order_result.status === 'FILLED') {
                    console.log("SELL PRICE: ", order_result.fills[0].price)
github jsappme / node-binance-trader / trader.js View on Github external
socket.on('user_payload', async (data) => {
    console.log(colors.grey('NBT HUB => user strategies + trading setup updated'))
    //console.log(data)
    user_payload = data
})
github atlasbot / bot / lib / Logger.js View on Github external
_getTime(color = true) {
		const date = new Date();

		let hour = date.getHours();
		hour = (hour < 10 ? '0' : '') + hour;

		let min = date.getMinutes();
		min = (min < 10 ? '0' : '') + min;

		let sec = date.getSeconds();
		sec = (sec < 10 ? '0' : '') + sec;

		const time = `${hour}:${min}:${sec}`;

		if (color) {
			return `${colors.white('[')}${colors.grey(time)}${colors.white(']')}`;
		}

		return `[${time}]`;
	}
};
github guo-yu / btc / libs / cli.js View on Github external
menu._relabel = function(index, label) {
        var exchanger = this.exchangers[index],
            afterfix = exchanger.autorefresh ? ' [Auto Refresh / ' + this._configs.autorefresh / 1000 + 's ]' : '';
        this.at(index).label = this._align(exchanger.name, 13) + label + colors.grey(afterfix);
        this.draw();
    };
github brickyang / egg-console / app / middleware / console.js View on Github external
let status;
    let level = 'info';
    const message = [];

    try {
      await next();

      if (ctx.status < 400) {
        status = green(ctx.status);
      } else {
        level = 'warn';
        status = red(ctx.status);
      }

      if (debug && ctx.request.method.toUpperCase() !== 'GET') {
        const body = grey('\n', JSON.stringify(ctx.request.body));

        message.push(body);
      }
    } catch (err) {
      ctx.status = err.status || 500;

      if (ctx.status === 500) level = 'error';
      else level = 'warn';

      status = red(ctx.status);

      if (error) {
        message.push('\n', err);
      }
    } finally {
      message.unshift(status);