Documentation ¶
Overview ¶
Package author handles rendering usernames.
Index ¶
Constants ¶
const ChipAvatarSize = 20 // smaller than usual
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Chip ¶
type Chip struct { *gtk.Box Avatar *onlineimage.Avatar Name *gtk.Label // contains filtered or unexported fields }
Chip describes a user chip. It is used for display in messages and for composing messages in the composer bar.
In Material Design, chips are described as "compact elements tha represen an input, attribute, or action." People who have used Google Mail before will have seen it when they input an email address into the "To" field and having it turn into a small box showing the user information in a friendlier way instead of being an email address.
Note that due to how chips are currently implemented, it only works well at certain font scale ranges. Once the font scale is beyond ~1.3, flaws will start to be very apparent. In that case, the user should use proper graphics scaling using Wayland, not using hacks like font scaling.
func (*Chip) InsertText ¶
func (c *Chip) InsertText(text *gtk.TextView, iter *gtk.TextIter) *gtk.TextChildAnchor
InsertText inserts the chip into the given TextView at the given TextIter. The inserted anchor is returned.
type MarkupMod ¶
type MarkupMod func(opts *markupOpts)
MarkupMod is a function type that Markup can take multiples of. It changes subtle behaviors of the Markup function, such as the color hasher used.
func WithMention ¶
func WithMention() MarkupMod
WithMention makes the renderer prefix an at ("@") symbol.
func WithMinimal ¶
func WithMinimal() MarkupMod
WithMinimal renders the markup without additional information, such as pronouns.
func WithSuffix ¶
WithSuffix adds a small grey suffix string into the output string if the Minimal flag is not present.
func WithSuffixMarkup ¶
WithSuffixMarkup is like WithSuffix, except the input is taken as valid markup.
func WithTextTagAttr ¶
WithTextTagAttr sets the given attribute into the text tag used for the author. It is only useful for Text.