Skip to content

Shan1024/chalk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chalk

Bring colors to Ballerina programs.

chalk

Supported colors

  1. Black
  2. Red
  3. Green
  4. Yellow
  5. Blue
  6. Purple
  7. Cyan
  8. White

Supported text properties

  1. Underline
  2. Italicize
  3. Reverse (background and foreground colors)
  4. Dark color mode
  5. Light color mode

Sample

First, import the chalk package.

import shan1024/chalk;

Create a new chalk object. The first argument is the foreground color and the second argument is the background color.

chalk:Chalk chalk = new(chalk:WHITE, chalk:RED);

You can make the text italicized and underlined as well through default-able parameters.

chalk:Chalk chalk = new(chalk:WHITE, chalk:RED, italicize = true, underline = true);

Start colorizing your texts.

string colorizedText = chalk.write("Hello world !!!");
io:println(colorizedText);

Chained invocations are supported.

string colorizedText = chalk.dark().italicize().reverse().write("Hello world !!!");
io:println(colorizedText);

So you can customize the chalk any way you want. Cool, right !!! ;)

[Inspired by the node module with the same name]

About

Bring colors to Ballerina programs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published