Module

Choku

Package
purescript-choku
Repository
m15a/purescript-choku

This module imports and re-exports some default submodules for convenience, namely

  • Choku.Common
  • Choku.Color
  • Choku.Style
  • Choku.Stdout

The last one, Choku.Stdout, might not be for your use case, as it works in Eff and customized for the STDOUT stream. To use chalk in Aff, import Choku.Stdout.Aff or Choku.Stderr.Aff instead. To use chalk for the STDERR stream, import Choku.Stderr or Choku.Stderr.Aff instead.

Re-exports from Choku.Color

#Color Source

data Color

Constructors

Instances

Re-exports from Choku.Common

#Choku Source

newtype Choku

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

Instances

#withChokuFlipped Source

#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.

#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.

#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.

#(|&) Source

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

#(&|) Source

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

Re-exports from Choku.Stdout

#withStyle Source

withStyle :: String -> Style -> Effect String

Modify a string, using the default chalk for STDOUT, with the given style.

For example,

import Prelude
import Effect.Console
import Data.Maybe
import Partial.Unsafe
import Choku

log =<< "hello" `withStyle` (inverse >>> underline)

prints an inversed and underlined "hello" string.

#supportsColor Source

supportsColor :: Effect { has16m :: Boolean, has256 :: Boolean, hasBasic :: Boolean, level :: Int }

Provide detailed information of the color support level.

See https://github.com/chalk/chalk#supportscolor.

#choku Source

choku :: Effect Choku

Get the default chalk instance for STDOUT, automatically detecting the level of color support.

#(:&) Source

Operator alias for Choku.Stdout.withStyleFlipped (non-associative / precedence 7)

#(&:) Source

Operator alias for Choku.Stdout.withStyle (non-associative / precedence 7)

Re-exports from Choku.Style

#Style Source

type Style = Choku -> Choku

#yellowBright Source

#whiteBright Source

#underline Source

#strikethrough Source

#redBright Source

#magentaBright Source

#greenBright Source

#fg Source

fg :: Color -> Style

Modify foreground color.

#cyanBright Source

#blueBright Source

#blackBright Source

#bgYellowBright Source

#bgWhiteBright Source

#bgRedBright Source

#bgMagentaBright Source

#bgMagenta Source

#bgGreenBright Source

#bgCyanBright Source

#bgBlueBright Source

#bgBlackBright Source

#bg Source

bg :: Color -> Style

Modify background color.