Copyright | (c) Eric Mertens 2016 |
---|---|
License | ISC |
Maintainer | emertens@gmail.com |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
This module provides image renderers for messages.
Synopsis
- data MessageRendererParams = MessageRendererParams {}
- data RenderMode
- data IdentifierColorMode
- defaultRenderParams :: MessageRendererParams
- msgImage :: ZonedTime -> MessageRendererParams -> MessageBody -> (Image', Image', Image')
- metadataImg :: Palette -> IrcSummary -> Maybe (Image', Identifier, Maybe Identifier)
- ignoreImage :: Palette -> Image'
- quietIdentifier :: Palette -> Identifier -> Image'
- coloredUserInfo :: Palette -> RenderMode -> HashMap Identifier Highlight -> UserInfo -> Image'
- coloredIdentifier :: Palette -> IdentifierColorMode -> HashMap Identifier Highlight -> Identifier -> Image'
- cleanText :: Text -> Text
- cleanChar :: Char -> Char
- nickPad :: PaddingMode -> Image' -> Image'
- timeImage :: Palette -> TimeOfDay -> Image'
- drawWindowLine :: Palette -> Int -> PaddingMode -> WindowLine -> [Image']
- modesImage :: Attr -> HashMap Char Attr -> String -> Image'
- prettyTime :: Int -> String -> String
- parseIrcTextWithNicks :: Palette -> HashMap Identifier Highlight -> Bool -> Text -> Image'
- data Highlight
Documentation
data MessageRendererParams Source #
Parameters used when rendering messages
MessageRendererParams | |
|
data RenderMode Source #
Level of detail to use when rendering
NormalRender | only render nicknames |
DetailedRender | render full user info |
data IdentifierColorMode Source #
PrivmsgIdentifier | An identifier in a PRIVMSG |
NormalIdentifier | An identifier somewhere else |
defaultRenderParams :: MessageRendererParams Source #
Default MessageRendererParams
with no sigils or nicknames specified
:: ZonedTime | time of message |
-> MessageRendererParams | render parameters |
-> MessageBody | message body |
-> (Image', Image', Image') | prefix, image, full |
Construct a message given the time the message was received and its render parameters.
metadataImg :: Palette -> IrcSummary -> Maybe (Image', Identifier, Maybe Identifier) Source #
Returns image and identifier to be used when collapsing metadata messages.
ignoreImage :: Palette -> Image' Source #
Image used when treating ignored chat messages as metadata
quietIdentifier :: Palette -> Identifier -> Image' Source #
Render an identifier without using colors. This is useful for metadata.
:: Palette | color palette |
-> RenderMode | mode |
-> HashMap Identifier Highlight | highlights |
-> UserInfo | userinfo to draw |
-> Image' |
Render an a full user. In normal mode only the nickname will be rendered. If detailed mode the full user info including the username and hostname parts will be rendered. The nickname will be colored.
:: Palette | color palette |
-> IdentifierColorMode | draw mode |
-> HashMap Identifier Highlight | highlights |
-> Identifier | identifier to draw |
-> Image' |
Render a nickname in its hash-based color.
:: PaddingMode | padding mode |
-> Image' | input image |
-> Image' | padded image |
Optionally add padding to an input image according to the specified mode. If the input image is already wider than the specified padding mode, the image is returned unmodified.
timeImage :: Palette -> TimeOfDay -> Image' Source #
Render a ZonedTime
as time using quiet attributes
23:15
:: Palette | palette |
-> Int | draw columns |
-> PaddingMode | nick padding |
-> WindowLine | window line |
-> [Image'] | wrapped lines |
Render the normal view of a chat message line padded and wrapped.
prettyTime :: Int -> String -> String Source #
Render string representing seconds into days, hours, minutes, and seconds.
parseIrcTextWithNicks Source #
:: Palette | palette |
-> HashMap Identifier Highlight | Highlights |
-> Bool | explicit controls rendering |
-> Text | input text |
-> Image' | colored text |
Parse message text to construct an image. If the text has formatting control characters in it then the text will be rendered according to the formatting codes. Otherwise the nicknames in the message are highlighted.