This repository has been archived by the owner. It is now read-only.

crayon

🎨 Terminal Coloring library for Crystal

Crayon

Open Source Love Open Source Love PRs Welcome Build Status

Beautiful colored strings right inside your terminal. The Crystal way! 🎉

Installation

Add this to your application's shard.yml:

dependencies:
  crayon:
    github: crystalrealm/crayon

Usage

require "crayon"
cyanOnBlack = Crayon::Crayon.new("light_cyan", "black", {
  "bold" => true,
})

puts cyanOnBlack.apply("Hello from Crayon!")

You have the following color options to choose from for the foreground color:

  • red
  • black
  • green
  • yellow
  • blue
  • magenta
  • cyan
  • light_gray
  • dark_gray
  • light_red
  • light_green
  • light_yellow
  • light_blue
  • light_magenta
  • light_cyan
  • white

... and for the background:

  • black
  • red
  • green
  • yellow
  • blue
  • magenta
  • cyan
  • light_gray
  • dark_gray
  • light_red
  • light_green
  • light_yellow
  • light_blue
  • light_magenta
  • light_cyan
  • white

API

Crayon simply with uses 1 method. You create a new instance of Crayon::Crayon like so:

instance = Crayon::Crayon.new(@foreground : String, @background : String, *options)

Then, you can apply the colors to any string you wish:

instance.apply("Hello, World!")

Contributing

  1. Fork it (https://github.com/molnarmark/crayon/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

Repository

crayon

Owner
Statistic
  • 2
  • 0
  • 0
  • 0
  • 0
  • about 6 years ago
  • August 27, 2018
License

MIT License

Links
Synced at

Fri, 22 Nov 2024 13:32:36 GMT

Languages