matterhorn-50200.11.0: Terminal client for the Mattermost chat system

Safe HaskellNone
LanguageHaskell2010

Matterhorn.Themes

Contents

Synopsis

Documentation

Attribute names

Username formatting

colorUsername Source #

Arguments

:: Text

The username for the user currently running Matterhorn

-> Text

The username associated with the text to render

-> Text

The text to render

-> Widget a 

Render a string with a color chosen based on the text of a username.

This function takes some display text and renders it using an attribute based on the username associated with the text. If the username associated with the text is equal to the username of the user running Matterhorn, the display text is formatted with currentAttr. Otherwise it is formatted with an attribute chosen by hashing the associated username and choosing from amongst the username color hash buckets with usernameAttr.

Usually the first argument to this function will be myUsername st, where st is a ChatState.

The most common way to call this function is

@colorUsername (myUsername st) u u

The third argument is allowed to vary from the second since sometimes we call this with the user's status sigil as the third argument.

attrForUsername Source #

Arguments

:: Text

The username to get an attribute for

-> AttrName 

Return the attribute name to use for the specified username. The input username is expected to be the username only (i.e. no sigil).

If the input username is a special reserved username such as "all", the clientEmphAttr attribute name will be returned. Otherwise a hash-bucket username attribute name will be returned based on the hash value of the username and the number of hash buckets (usernameColorHashBuckets).

usernameColorHashBuckets :: Int Source #

The number of hash buckets to use when hashing usernames to choose their colors.