Skip to content

(v2) styling table not working as expected #520

@bashbunni

Description

@bashbunni

For the record, it's the same behaviour in v1, so not like it's broken in v2, it just never worked >.<. You should be able to set table styles with a Lip Gloss Style like so:

func main() {
	s := lipgloss.NewStyle().Foreground(lipgloss.Color("240")).Render
	baseStyle := lipgloss.NewStyle().Background(lipgloss.Color("#FF60FF")).Foreground(lipgloss.Color("#00FFB2"))

	t := table.New()
	t.Row("Bubble Tea", s("Milky"))
	t.Row("Milk Tea", s("Also milky"))
	t.Row("Actual milk", s("Milky as well"))
	fmt.Println(baseStyle.Render(t.String()))
}

want:

Image

got:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions