How to use the @boost/terminal.style.level function in @boost/terminal

To help you get started, we’ve selected a few @boost/terminal 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 milesj / boost / packages / core / src / Reporter.ts View on Github external
getColorPalette(): ColorPalette {
    const { theme = 'default' } = this.tool.config;
    let palette = {};

    /* eslint-disable global-require, import/no-dynamic-require */
    if (style.level >= 2 && theme !== 'default') {
      try {
        palette = require(`@boost/theme-${theme}`);
      } catch {
        try {
          palette = require(`boost-theme-${theme}`);
        } catch {
          throw new Error(
            `Theme could not be loaded. Attempted @boost/theme-${theme} and boost-theme-${theme}.`,
          );
        }
      }
    }

    return {
      default: 'white',
      failure: 'red',