🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

chalk.js

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chalk.js

[Chalk](//github.com/chalk/chalk) for the browser.

0.0.0
npm
Version published
Weekly downloads
23
130%
Maintainers
1
Weekly downloads
 
Created
Source

chalk.js

Chalk for the browser.

Demo

To see a demo, run yarn && yarn start.

Install

npm install chalk.js

then the example code below.

Example

<html>
  <body>
    <script src="node_modules/chalk.js/chalk.js"></script>

    <!-- How to manually create HTML elements from Chalk strings -->
    <div id="code">
    </div>
    <script>
      var html = AnsiHTML(Chalk.magenta.bold.italic.underline("Hello from HTML!"));
      document.getElementById("code").innerHTML = html;
    </script>

    <!-- How to use Chalk with xterm.js -->
    <link rel="stylesheet" href="node_modules/xterm/dist/xterm.css" />
    <script src="node_modules/xterm/dist/xterm.js"></script>

    <div id="terminal">
    </div>
    <script>
      var term = new Terminal();
      term.open(document.getElementById('terminal'));
term.write(`${Chalk.red("Hello")} from ${Chalk.bold.underline.bgCyanBright.black('xterm.js')} !`);
    </script>
  </body>
</html>

FAQs

Package last updated on 19 Jul 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts