How to use the cardinal/settings.resolveTheme function in cardinal

To help you get started, we’ve selected a few cardinal 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 sidorares / crconsole / index.js View on Github external
self.client.Debugger.getScriptSource({ scriptId: frame.location.scriptId }, function(err, resp) {
          self.writeLn('break in ' + [lineNumber, columnNumber].join(':'))
          var startLine = lineNumber - NUM_LINES;
          var lastLine  = lineNumber + NUM_LINES;
          var out = [];
          var src = cardinal.highlight(resp.scriptSource, {
            theme: resolveCardinalTheme()
          }).split('\n');
          for (var i=startLine; i < lastLine; ++i) {
            var prefix = pad(lastLine, lineNumber, i);
            var bpsForLine = self.breakpointsForLocation({
              scriptId: frame.location.scriptId,
              lineNumber: i
            });
            if (bpsForLine) {
              prefix = prefix.red;
            }

            if (src[i])
              out.push(prefix + src[i]);
          }
          self.writeLn(out.join('\n'));
          // TODO mark current column with underline?

cardinal

Syntax highlights JavaScript code with ANSI colors to be printed to the terminal.

MIT
Latest version published 7 years ago

Package Health Score

67 / 100
Full package analysis