> For the complete documentation index, see [llms.txt](https://aceius.gitbook.io/wiki/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://aceius.gitbook.io/wiki/javascript-libraries/spray-print.md).

# spray-print

Colorized print

spray-print is a library that makes your console prints more vibrant using chalk.

## Installation

{% tabs %}
{% tab title="NPM" %}

```bash
npm install spray-print
```

{% endtab %}

{% tab title="Yarn" %}

```
yarn add spray-print
```

{% endtab %}
{% endtabs %}

Once you've added spray print to your project, you have to require it in your file.

```javascript
const print = require('spray-print');
```

## Usage

There are several types of printouts, and a custom one too:

```javascript
print.println('Message');
print.warn('Warning');
print.error('Error');
print.success(':D');
print.custom('title','message');
```

There is also an alternate styling choice that uses `(!)` instead of `[!]`:

```javascript
print.cprint('Message');
print.cwarn('Warning');
print.cerror('Error');
print.csuccess(':D');
```

Anything that works with `console.log` works here, so you can still display variables and join strings.

### Standard Print

![](https://1902384657-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MY7RB16oSPsunzUS1eG%2F-Meh-JH8IpWNnj_V0YDU%2F-Meh0E1aVmO0MwoiA64S%2FScreenshot%20from%202021-07-15%2018-53-13.png?alt=media\&token=01864bb7-476a-4ea2-87c4-641cc3f5ecef)

```javascript
print.println('Message');
print.cprint('Message'); // Alternate Style
```

A standard print is signified by a blue `!` character inside brackets.

### Warning Print

![](https://1902384657-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MY7RB16oSPsunzUS1eG%2F-Meh-JH8IpWNnj_V0YDU%2F-Meh28nqkNJu6yvKxRIp%2FScreenshot%20from%202021-07-15%2019-01-19.png?alt=media\&token=d40e7e61-87d9-44e4-8cab-916382bbc5c9)

```javascript
print.warn('Warning');
print.cwarn('Warning'); // Alternate Style
```

A standard print is signified by a yellow `!` character inside brackets.

### Error Print

![](https://1902384657-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MY7RB16oSPsunzUS1eG%2F-Meh-JH8IpWNnj_V0YDU%2F-Meh2CGzDh0GuZrhaw9j%2FScreenshot%20from%202021-07-15%2019-01-26.png?alt=media\&token=75b6990c-7965-48fa-907e-4e957ceb2bce)

```javascript
print.error('Error');
print.cerror('Error'); // Alternate Style
```

A standard print is signified by a red `!` character inside brackets. It's advised you use this over `console.error` in nodejs commandline apps, as it stands out more.

### Success Print

![](https://1902384657-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MY7RB16oSPsunzUS1eG%2F-Meh-JH8IpWNnj_V0YDU%2F-Meh2JqivgY_CNrqVk4Z%2FScreenshot%20from%202021-07-15%2019-01-33.png?alt=media\&token=4b499f6c-c564-4342-90fc-a74449dabbd9)

```javascript
print.success('Success');
print.csuccess('Success'); // Alternate Style
```

A standard print is signified by a green `!` character inside brackets. Should be used to show that a task completed successfully.

### Custom Print

![](https://1902384657-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MY7RB16oSPsunzUS1eG%2F-Meh-JH8IpWNnj_V0YDU%2F-Meh2MG1nDdX3QniFSfL%2FScreenshot%20from%202021-07-15%2019-01-40.png?alt=media\&token=8b991338-fd2a-43f1-a690-b0f29e40be21)

```javascript
print.custom('Title','Text');
```

A standard print is signified by blue text inside brackets. This text is derived from the first given argument, while the second is the content.

{% hint style="warning" %}
On version 1.0.0, using this command will throw an error.
{% endhint %}

## Links

* <https://github.com/AceiusIO/spray-print> - GitHub
* <https://www.npmjs.com/package/spray-print> - NPM Page
