Modern message bubble widget for Go Fyne GUI toolkit.
- Automatically update colors when switching between light/dark themes
- Set colors for the bubble, message, and time for light and dark themes
- Support for text selection, which is probably important for any chat
- Changing the corner radius
go get github.com/limafresh/messagebubble/v2@latest
bubble := messagebubble.NewMessageBubble(
"Alex", // sender's name
"Hi, how are you?", // message text
"13:36", // sending time
false, // mine: true, other: false
)bubble.Colors.Bubble.Mine = []color.NRGBA{
{255, 51, 0, 255}, // for light theme
{153, 0, 255, 255}, // for dark theme
}Available: Bubble.Mine, Bubble.Other, Text.Mine, Text.Other, Time.Mine, Time.Other.
| Field | Value | Description |
|---|---|---|
Colors |
*messagebubble.Colors | Bubble colors |
CornerRadius |
float32 | The radius of the bubble's corners |
TimeSize |
float32 | The size of the time label |
HideSender |
bool | Whether to hide the sender label (in messages not mine) |
HideTime |
bool | Whether to hide the time label |
Example:
bubble.CornerRadius = 16
bubble.TimeSize = 10DefaultCornerRadiusDefaultTimeSizeDefaultMaxWidth
For example, let's change CornerRadius of all bubbles in vbox:
for _, obj := range vbox.Objects {
if bubble, ok := obj.(*messagebubble.MessageBubble); ok {
bubble.CornerRadius = 16
}
}