hscolour-1.18: Colourise Haskell code.




data Colour Source

Colours supported by ANSI codes.

data Highlight Source

Types of highlighting supported by ANSI codes (and some extra styles).

base256 :: Integral int => (Word8 -> Word8 -> Word8 -> r) -> int -> rSource

Convert an integer in the range [0,2^24-1] to its base 256-triplet, passing the result to the given continuation (avoid unnecessary tupleism).

unbase :: Integral int => int -> Word8 -> Word8 -> Word8 -> intSource

Convert a three-digit numeral in the given (as arg 1) base to its integer value.

rgb24bit_to_xterm256 :: Integral t => Word8 -> Word8 -> Word8 -> tSource

Approximate a 24-bit Rgb colour with a colour in the xterm256 6x6x6 colour cube, returning its index.

projectToBasicColour8 :: Colour -> ColourSource

Ap"proxi"mate a 24-bit Rgb colour with an ANSI8 colour. Will leave other colours unchanged and will never return an Rgb constructor value.