Karya, built on 2023-08-29T07:47:28 (patch 7a412d5d6ba4968ca4155ef276a062ccdeb9109a)
Safe HaskellSafe-Inferred

Util.Styled

Description

A simple Styled Text implementation. There are a few others on hackage (terminal-text, rainbow, ...), but they're all too complicated for me.

Examples: > printLn $ fgs (bright red) "hi" <> fgs red "there" > printLn $ bgs (bright red) "hi" <> bgs red "there" > printLn $ underlines "hi" <> " " <> bolds "there" > printLn $ underlines $ fgs (bright red) "hi" <> fgs red "there"

printLn $ bgs cyan "hello\nthere"
printLn $ bgs cyan "hello" <> "\n" <> bgs cyan "there"
Synopsis

Documentation

data Styled Source #

Instances

Instances details
String.IsString Styled Source # 
Instance details

Defined in Util.Styled

Monoid Styled Source # 
Instance details

Defined in Util.Styled

Semigroup Styled Source # 
Instance details

Defined in Util.Styled

Show Styled Source # 
Instance details

Defined in Util.Styled

Eq Styled Source # 
Instance details

Defined in Util.Styled

Methods

(==) :: Styled -> Styled -> Bool #

(/=) :: Styled -> Styled -> Bool #

data Style Source #

Instances

Instances details
Monoid Style Source # 
Instance details

Defined in Util.Styled

Methods

mempty :: Style #

mappend :: Style -> Style -> Style #

mconcat :: [Style] -> Style #

Semigroup Style Source #

Left side overrides the right side, for consistency with other Semigroups.

Instance details

Defined in Util.Styled

Methods

(<>) :: Style -> Style -> Style #

sconcat :: NonEmpty Style -> Style #

stimes :: Integral b => b -> Style -> Style #

Show Style Source # 
Instance details

Defined in Util.Styled

Eq Style Source # 
Instance details

Defined in Util.Styled

Methods

(==) :: Style -> Style -> Bool #

(/=) :: Style -> Style -> Bool #

data Color Source #

Constructors

Ansi !AnsiColor 
Rgb !RgbColor 

Instances

Instances details
Show Color Source # 
Instance details

Defined in Util.Styled

Eq Color Source # 
Instance details

Defined in Util.Styled

Methods

(==) :: Color -> Color -> Bool #

(/=) :: Color -> Color -> Bool #

data RgbColor Source #

Instances

Instances details
Show RgbColor Source # 
Instance details

Defined in Util.Styled

Eq RgbColor Source # 
Instance details

Defined in Util.Styled

data AnsiColor Source #

Instances

Instances details
Show AnsiColor Source # 
Instance details

Defined in Util.Styled

Eq AnsiColor Source # 
Instance details

Defined in Util.Styled

styled :: ToStyled a => Style -> a -> Styled Source #

fg :: ToStyled a => Color -> a -> Styled Source #

bg :: ToStyled a => Color -> a -> Styled Source #

bold :: ToStyled a => a -> Styled Source #

underline :: ToStyled a => a -> Styled Source #

text util

html