charmbracelet / lipgloss

Style definitions for nice terminal layouts 👄
MIT License
8.22k stars 231 forks source link

Fix README table example #328

Open frejonb opened 4 months ago

frejonb commented 4 months ago

I typically don't create PRs for trivial changes, but in this case I was learning lipgloss and it took me a bit to find the correct row styles from the table example in the README.

bashbunni commented 3 months ago

Hey @frejonb thank you so much for your contribution! I also found table styling a bit confusing at first. I do think it makes sense to highlight this more explicitly for new users. I do have some feedback on this PR :)

If we're going to add information about styling lists it should look similar to the list section. Add a blurb mentioning custom styles, followed by a working example + capture of the output.

Tables can have custom border styles set by Lipgloss.Style using the BorderStyle function. Additionally, table content can be stylized using StyleFunc which supports conditional formatting.

// an example using BorderStyle and StyleFunc

<an image generated with freeze -x "go run ./my-example" -r 10 --window --font.size 36 --margin 20>