https://github.com/scalajs-io/colors
get colors in your node.js console
https://github.com/scalajs-io/colors
color colors node nodejs npm scala scalajs
Last synced: 4 months ago
JSON representation
get colors in your node.js console
- Host: GitHub
- URL: https://github.com/scalajs-io/colors
- Owner: scalajs-io
- License: apache-2.0
- Created: 2017-02-06T05:18:14.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-06-17T23:07:45.000Z (about 6 years ago)
- Last Synced: 2025-01-17T22:42:49.780Z (5 months ago)
- Topics: color, colors, node, nodejs, npm, scala, scalajs
- Language: Scala
- Size: 17.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Colors API for Scala.js
================================
[colors](https://www.npmjs.com/package/colors) - get colors in your node.js console.### Description
get color and style in your node.js console
### Build Requirements
* [SBT v1.2.x](http://www.scala-sbt.org/download.html)
### Build/publish the SDK locally
```bash
$ sbt clean publish-local
```### Running the tests
Before running the tests the first time, you must ensure the npm packages are installed:
```bash
$ npm install
```Then you can run the tests:
```bash
$ sbt test
```### Examples
```scala
import io.scalajs.nodejs.console
import io.scalajs.npm.colors._
import scala.scalajs.jsconsole.log(Colors.green("hello")) // outputs green text
console.log(Colors.red.underline("i like cake and pies")) // outputs red underlined text
console.log(Colors.inverse("inverse the color")) // inverses the color
console.log(Colors.rainbow("OMG Rainbows!")) // rainbow
console.log(Colors.trap("Run the trap")) // Drops the bassconsole.log("hello".green) // outputs green text
console.log("i like cake and pies".underline.red) // outputs red underlined text
console.log("inverse the color".inverse) // inverses the color
console.log("OMG Rainbows!".rainbow) // rainbow
console.log("Run the trap".trap) // Drops the bass
Colors.setTheme(
js.Dictionary(
"silly" -> "rainbow",
"input" -> "grey",
"verbose" -> "cyan",
"prompt" -> "grey",
"info" -> "green",
"data" -> "grey",
"help" -> "cyan",
"warn" -> "yellow",
"debug" -> "blue",
"error" -> "red"
))// outputs red text
console.log("this is an error" <<= "error")// outputs yellow text
console.log("this is a warning" <<= "warn")
```
### Artifacts and ResolversTo add the `Colors` binding to your project, add the following to your build.sbt:
```sbt
libraryDependencies += "io.scalajs.npm" %%% "colors" % "0.5.0"
```Optionally, you may add the Sonatype Repository resolver:
```sbt
resolvers += Resolver.sonatypeRepo("releases")
```