-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #189 from Kevin-Lee/task/188/add-syntax-seq-string…
…-rainbowed Close #188 - [`extras-scala-io`] Add syntax: `Seq[String].rainbowed`
- Loading branch information
Showing
5 changed files
with
75 additions
and
75 deletions.
There are no files selected for viewing
9 changes: 8 additions & 1 deletion
9
...ras-scala-io/shared/src/main/scala-2/extras/scala/io/syntax/truecolor/RainbowSyntax.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,24 @@ | ||
package extras.scala.io.syntax.truecolor | ||
|
||
import extras.scala.io.syntax.truecolor.RainbowSyntax.RainbowSyntaxOps | ||
import extras.scala.io.syntax.truecolor.RainbowSyntax.{RainbowSyntaxOps, RainbowsSyntaxOps} | ||
import extras.scala.io.truecolor.Rainbow | ||
|
||
/** @author Kevin Lee | ||
* @since 2022-06-13 | ||
*/ | ||
trait RainbowSyntax { | ||
implicit def rainbowSyntax(s: String): RainbowSyntaxOps = new RainbowSyntaxOps(s) | ||
|
||
implicit def rainbowsSyntax(ss: Seq[String]): RainbowsSyntaxOps = new RainbowsSyntaxOps(ss) | ||
} | ||
object RainbowSyntax { | ||
class RainbowSyntaxOps(private val s: String) extends AnyVal { | ||
def rainbowed: String = Rainbow.rainbow(s) | ||
def rainbowedHtml: String = Rainbow.rainbowHtml(s) | ||
} | ||
|
||
class RainbowsSyntaxOps(private val ss: Seq[String]) extends AnyVal { | ||
def rainbowed: Seq[String] = Rainbow.rainbows(ss) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
modules/extras-scala-io/shared/src/test/scala/extras/scala/io/truecolor/Data.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package extras.scala.io.truecolor | ||
|
||
/** @author Kevin Lee | ||
* @since 2022-07-07 | ||
*/ | ||
object Data { | ||
|
||
val rainbowAsciiArt: Seq[String] = | ||
List( | ||
""" ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄ ▄ ▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄ ▄ """, | ||
"""▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░▌ ▐░▌▐░░░░░░░░░░▌ ▐░░░░░░░░░░░▌▐░▌ ▐░▌""", | ||
"""▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀█░▌ ▀▀▀▀█░█▀▀▀▀ ▐░▌░▌ ▐░▌▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀█░▌▐░▌ ▐░▌""", | ||
"""▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌▐░▌ ▐░▌▐░▌ ▐░▌▐░▌ ▐░▌""", | ||
"""▐░█▄▄▄▄▄▄▄█░▌▐░█▄▄▄▄▄▄▄█░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌▐░█▄▄▄▄▄▄▄█░▌▐░▌ ▐░▌▐░▌ ▄ ▐░▌""", | ||
"""▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌▐░░░░░░░░░░▌ ▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌""", | ||
"""▐░█▀▀▀▀█░█▀▀ ▐░█▀▀▀▀▀▀▀█░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌▐░█▀▀▀▀▀▀▀█░▌▐░▌ ▐░▌▐░▌ ▐░▌░▌ ▐░▌""", | ||
"""▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌▐░▌▐░▌ ▐░▌▐░▌ ▐░▌▐░▌▐░▌ ▐░▌▐░▌""", | ||
"""▐░▌ ▐░▌ ▐░▌ ▐░▌ ▄▄▄▄█░█▄▄▄▄ ▐░▌ ▐░▐░▌▐░█▄▄▄▄▄▄▄█░▌▐░█▄▄▄▄▄▄▄█░▌▐░▌░▌ ▐░▐░▌""", | ||
"""▐░▌ ▐░▌▐░▌ ▐░▌▐░░░░░░░░░░░▌▐░▌ ▐░░▌▐░░░░░░░░░░▌ ▐░░░░░░░░░░░▌▐░░▌ ▐░░▌""", | ||
""" ▀ ▀ ▀ ▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀ ▀▀ ▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀▀ ▀▀ """ | ||
) | ||
|
||
val expectedRainbowAsciiArt: String = { | ||
import Rainbow._ | ||
import extras.scala.io.Color | ||
// format: off | ||
List( | ||
s"""${Red.toAsciiEsc} ▄▄▄▄▄▄▄▄▄▄▄ ${Orange.toAsciiEsc} ▄▄▄▄▄▄▄▄▄▄▄ ${Yellow.toAsciiEsc} ▄▄▄▄▄▄▄▄▄▄▄ ${Green.toAsciiEsc} ▄▄ ▄ ${Blue.toAsciiEsc} ▄▄▄▄▄▄▄▄▄▄ ${Indigo.toAsciiEsc} ▄▄▄▄▄▄▄▄▄▄▄ ${Violet.toAsciiEsc} ▄ ▄ ${Color.reset.toAnsi}""", | ||
s"""${Red.toAsciiEsc}▐░░░░░░░░░░░▌${Orange.toAsciiEsc}▐░░░░░░░░░░░▌${Yellow.toAsciiEsc}▐░░░░░░░░░░░▌${Green.toAsciiEsc}▐░░▌ ▐░▌${Blue.toAsciiEsc}▐░░░░░░░░░░▌ ${Indigo.toAsciiEsc}▐░░░░░░░░░░░▌${Violet.toAsciiEsc}▐░▌ ▐░▌${Color.reset.toAnsi}""", | ||
s"""${Red.toAsciiEsc}▐░█▀▀▀▀▀▀▀█░▌${Orange.toAsciiEsc}▐░█▀▀▀▀▀▀▀█░▌${Yellow.toAsciiEsc} ▀▀▀▀█░█▀▀▀▀ ${Green.toAsciiEsc}▐░▌░▌ ▐░▌${Blue.toAsciiEsc}▐░█▀▀▀▀▀▀▀█░▌${Indigo.toAsciiEsc}▐░█▀▀▀▀▀▀▀█░▌${Violet.toAsciiEsc}▐░▌ ▐░▌${Color.reset.toAnsi}""", | ||
s"""${Red.toAsciiEsc}▐░▌ ▐░▌${Orange.toAsciiEsc}▐░▌ ▐░▌${Yellow.toAsciiEsc} ▐░▌ ${Green.toAsciiEsc}▐░▌▐░▌ ▐░▌${Blue.toAsciiEsc}▐░▌ ▐░▌${Indigo.toAsciiEsc}▐░▌ ▐░▌${Violet.toAsciiEsc}▐░▌ ▐░▌${Color.reset.toAnsi}""", | ||
s"""${Red.toAsciiEsc}▐░█▄▄▄▄▄▄▄█░▌${Orange.toAsciiEsc}▐░█▄▄▄▄▄▄▄█░▌${Yellow.toAsciiEsc} ▐░▌ ${Green.toAsciiEsc}▐░▌ ▐░▌ ▐░▌${Blue.toAsciiEsc}▐░█▄▄▄▄▄▄▄█░▌${Indigo.toAsciiEsc}▐░▌ ▐░▌${Violet.toAsciiEsc}▐░▌ ▄ ▐░▌${Color.reset.toAnsi}""", | ||
s"""${Red.toAsciiEsc}▐░░░░░░░░░░░▌${Orange.toAsciiEsc}▐░░░░░░░░░░░▌${Yellow.toAsciiEsc} ▐░▌ ${Green.toAsciiEsc}▐░▌ ▐░▌ ▐░▌${Blue.toAsciiEsc}▐░░░░░░░░░░▌ ${Indigo.toAsciiEsc}▐░▌ ▐░▌${Violet.toAsciiEsc}▐░▌ ▐░▌ ▐░▌${Color.reset.toAnsi}""", | ||
s"""${Red.toAsciiEsc}▐░█▀▀▀▀█░█▀▀ ${Orange.toAsciiEsc}▐░█▀▀▀▀▀▀▀█░▌${Yellow.toAsciiEsc} ▐░▌ ${Green.toAsciiEsc}▐░▌ ▐░▌ ▐░▌${Blue.toAsciiEsc}▐░█▀▀▀▀▀▀▀█░▌${Indigo.toAsciiEsc}▐░▌ ▐░▌${Violet.toAsciiEsc}▐░▌ ▐░▌░▌ ▐░▌${Color.reset.toAnsi}""", | ||
s"""${Red.toAsciiEsc}▐░▌ ▐░▌ ${Orange.toAsciiEsc}▐░▌ ▐░▌${Yellow.toAsciiEsc} ▐░▌ ${Green.toAsciiEsc}▐░▌ ▐░▌▐░▌${Blue.toAsciiEsc}▐░▌ ▐░▌${Indigo.toAsciiEsc}▐░▌ ▐░▌${Violet.toAsciiEsc}▐░▌▐░▌ ▐░▌▐░▌${Color.reset.toAnsi}""", | ||
s"""${Red.toAsciiEsc}▐░▌ ▐░▌ ${Orange.toAsciiEsc}▐░▌ ▐░▌${Yellow.toAsciiEsc} ▄▄▄▄█░█▄▄▄▄ ${Green.toAsciiEsc}▐░▌ ▐░▐░▌${Blue.toAsciiEsc}▐░█▄▄▄▄▄▄▄█░▌${Indigo.toAsciiEsc}▐░█▄▄▄▄▄▄▄█░▌${Violet.toAsciiEsc}▐░▌░▌ ▐░▐░▌${Color.reset.toAnsi}""", | ||
s"""${Red.toAsciiEsc}▐░▌ ▐░▌${Orange.toAsciiEsc}▐░▌ ▐░▌${Yellow.toAsciiEsc}▐░░░░░░░░░░░▌${Green.toAsciiEsc}▐░▌ ▐░░▌${Blue.toAsciiEsc}▐░░░░░░░░░░▌ ${Indigo.toAsciiEsc}▐░░░░░░░░░░░▌${Violet.toAsciiEsc}▐░░▌ ▐░░▌${Color.reset.toAnsi}""", | ||
s"""${Red.toAsciiEsc} ▀ ▀ ${Orange.toAsciiEsc} ▀ ▀ ${Yellow.toAsciiEsc} ▀▀▀▀▀▀▀▀▀▀▀ ${Green.toAsciiEsc} ▀ ▀▀ ${Blue.toAsciiEsc} ▀▀▀▀▀▀▀▀▀▀ ${Indigo.toAsciiEsc} ▀▀▀▀▀▀▀▀▀▀▀ ${Violet.toAsciiEsc} ▀▀ ▀▀ ${Color.reset.toAnsi}""" | ||
).mkString("\n") | ||
// format: on | ||
} | ||
|
||
} |
Oops, something went wrong.