Module

Choku.Common

Package
purescript-choku
Repository
m15a/purescript-choku

The Choku type and its common interface.

#Choku Source

newtype Choku

The Choku type, simply wrapping a Chalk instance in the Javascript layer.

Instances

#level Source

level :: Choku -> Int

Return the color support level of the given chalk.

Higher level means more colors are supported. For detail, see https://github.com/chalk/chalk#chalklevel.

#mkChoku Source

mkChoku :: Int -> Maybe Choku

Create a new chalk instance with the specified level of color support.

The level should be an integer bounded between 0 and 3. An out-of-bounds integer produces Nothing.

#withChoku Source

withChoku :: String -> Choku -> String

Modify a string with the chalk.

For example,

import Prelude
import Data.Maybe
import Partial.Unsafe
import Choku
let
  chk = unsafePartial $ fromJust (mkChoku 3) # bold # cyan
in
  "hello" `withChoku` chk

produces a bold cyan "hello" string.

#(&|) Source

Operator alias for Choku.Common.withChoku (non-associative / precedence 7)

#withChokuFlipped Source

#(|&) Source

Operator alias for Choku.Common.withChokuFlipped (non-associative / precedence 7)