Copyright | (c) Eric Mertens 2016 |
---|---|
License | ISC |
Maintainer | emertens@gmail.com |
Safe Haskell | None |
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 :: IrcSummary -> Maybe (Image', Identifier, Maybe Identifier)
- ignoreImage :: Image'
- quietIdentifier :: Palette -> Identifier -> Image'
- coloredUserInfo :: Palette -> RenderMode -> HashSet Identifier -> UserInfo -> Image'
- coloredIdentifier :: Palette -> IdentifierColorMode -> HashSet Identifier -> Identifier -> Image'
- cleanText :: Text -> Text
- cleanChar :: Char -> Char
- nickPad :: PaddingMode -> Image' -> Image'
- timeImage :: Palette -> TimeOfDay -> Image'
- drawWindowLine :: Palette -> Int -> PaddingMode -> WindowLine -> [Image']
- parseIrcTextWithNicks :: Palette -> HashSet Identifier -> HashSet Identifier -> Bool -> Text -> Image'
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 :: IrcSummary -> Maybe (Image', Identifier, Maybe Identifier) Source #
Returns image and identifier to be used when collapsing metadata messages.
ignoreImage :: 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 |
-> HashSet Identifier | my nicks |
-> 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 |
-> HashSet Identifier | my nicknames |
-> 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.
parseIrcTextWithNicks Source #
:: Palette | palette |
-> HashSet Identifier | my nicks |
-> HashSet Identifier | other nicks |
-> 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.