Skip to content
This repository was archived by the owner on Sep 13, 2018. It is now read-only.

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

🎨 Terminal Coloring library for Crystal

Topics

Resources

Stars

2 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages