Skip to content

SIBAI/spells

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

spells

This is a small scala "util" library, which will hopefully grow over time.

Features:

  • AnsiPrint - ansi styled outputs for your strings

Usage

Requirements

Configuring your project's dependencies

Add these lines to your SBT build file:

resolvers += Resolver.sonatypeRepo("releases") // optional, but quicker

libraryDependencies += "com.github.agilesteel" % "spells_2.10" % "1.4"

Examples

Here is an example of AnsiPrint in action:

package myproject

import spells._
 
object Ansi extends App {
   println("white")
   println("green")(Green)
   println("green".green)
   println(1337.cyan)
   println("magenta".magenta)(Green)
   println("yellow".yellow + "green".green + "yellow".yellow)(Yellow)
   println("yellow" + "green".green)(Yellow)
   println("yellow".yellow + "green")(Green)
   println("yellow" + "green".green + "yellow")(Yellow)
   println("yellow".yellow + "green" + "yellow".yellow)(Green)
   println("yellow" + "green".green + "yellow".yellow)(Yellow)
   println("yellow".yellow + "green".green + "yellow")(Yellow)
   println("yellow" + "red".red + "yellow" + "green".green + "yellow")(Yellow)
}

object UsingCustomStyles extends App {
   val customStyle = "someStyle".toAnsiStyle
   println("styled" in customStyle)
}

object OverridingDefaultStyle extends App {
   implicit val defaultStyle = Yellow
   println("yellow" + "red".red + "yellow" + "green".green + "yellow")
}

object OverridingDefaultStyleWithCustomStyle extends App {
   implicit val defaultStyle = "someStyle".toAnsiStyle
   println("styled")
}

About

This is a small scala "util" library, which will hopefully grow over time.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Scala 100.0%