Documentation ¶
Overview ¶
Package apptheme provides domain-specific material design chat widgets.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( DefaultMaxImageHeight = unit.Dp(400) DefaultMaxMessageWidth = unit.Dp(600) DefaultAvatarSize = unit.Dp(24) )
Note: the values choosen are a best-guess heuristic, open to change.
var ( Light = Palette{ Error: rgb(0xB00020), Surface: rgb(0xFFFFFF), Bg: rgb(0xDCDCDC), BgSecondary: rgb(0xEBEBEB), OnError: rgb(0xFFFFFF), OnSurface: rgb(0x000000), OnBg: rgb(0x000000), OnBgSecondary: rgb(0x000000), } Dark = Palette{ Error: rgb(0xB00020), Surface: rgb(0x222222), Bg: rgb(0x000000), BgSecondary: rgb(0x444444), OnError: rgb(0xFFFFFF), OnSurface: rgb(0xFFFFFF), OnBg: rgb(0xEEEEEE), OnBgSecondary: rgb(0xFFFFFF), } )
Functions ¶
Types ¶
type D ¶
type D = layout.Dimensions
type Palette ¶
type Palette struct { // Error used to indicate errors. Error color.NRGBA OnError color.NRGBA // Surface affect surfaces of components, such as cards, sheets and menus. Surface color.NRGBA OnSurface color.NRGBA // Bg appears behind scrollable content. Bg color.NRGBA OnBg color.NRGBA // BgSecondary appears behind scrollable content. BgSecondary color.NRGBA OnBgSecondary color.NRGBA }
Palette defines non-brand semantic colors.
`On` colors define a color that is appropriate to display atop it's counterpart.
type RoomConfig ¶
type RoomConfig struct { // Name of the room as raw text. Name string // Image of the room. Image image.Image // Content of the latest message as raw text. Content string // SentAt timestamp of the latest message. SentAt time.Time }
RoomConfig configures room item display.
type RoomStyle ¶
type RoomStyle struct { *appwidget.Room Image matchat.Image Name material.LabelStyle Summary material.LabelStyle TimeStamp material.LabelStyle Indicator color.NRGBA Overlay color.NRGBA }
RoomStyle lays out a room select card.
type Theme ¶
type Theme struct { *material.Theme // UserColors tracks a mapping from chat username to the color // chosen to represent that user. UserColors map[string]UserColorData // AvatarSize specifies how large the avatar image should be. AvatarSize unit.Dp // Palette specifies semantic colors. Palette Palette }
Theme wraps the material.Theme with useful application-specific theme information.
func (*Theme) Contrast ¶
Contrast against a given luminance.
Defaults to a color that contrasts the background color, if the threshold is met, the background color itself is returned.
Note this will depend on the specific palette in question, and may not be a good generalization particularly for low-contrast palettes.
func (*Theme) LocalUserColor ¶
func (t *Theme) LocalUserColor() UserColorData
LocalUserColor returns a color for the "local" user. Local user color is defined as the theme's surface color and it's luminance.
func (*Theme) Toggle ¶
func (t *Theme) Toggle()
Toggle the active theme between pre-configured Light and Dark palettes.
func (*Theme) UsePalette ¶
UsePalette changes to the specified palette.
func (*Theme) UserColor ¶
func (t *Theme) UserColor(username string) UserColorData
UserColor returns a color for the provided username. It will choose a new color if the username is new.
type UserColorData ¶
UserColorData tracks both a color and its luminance.