-
Notifications
You must be signed in to change notification settings - Fork 276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(table): More granular table styles #246 #340
Conversation
This week is nuts. Hopefully, on the weekend, I will be able to tinker with your code |
Works for me. docs are missing. |
Part of me wonders if it would be more streamlined to extend the existing The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much for the PR! Looking forward to seeing the updates. It'll be great to be able to customize these tables further
renderedCell := m.styles.Cell.Render(style.Render(runewidth.Truncate(value, m.cols[i].Width, "…"))) | ||
overlayedStyle := cellStyles[i].Inherit(rowStyle) | ||
overlayedStyle = overlayedStyle.Copy().Inherit(selStyle).Padding(0, 1) | ||
//renderedCell := cellStyles[i].Inherit(rowStyle).Render(style.Render(runewidth.Truncate(value, m.cols[i].Width, "…"))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete commented code
for i, value := range m.rows[rowID] { | ||
style := lipgloss.NewStyle().Width(m.cols[i].Width).MaxWidth(m.cols[i].Width).Inline(true) | ||
renderedCell := m.styles.Cell.Render(style.Render(runewidth.Truncate(value, m.cols[i].Width, "…"))) | ||
overlayedStyle := cellStyles[i].Inherit(rowStyle) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does this overlayedStyle do?
if m.CustomRowStyle != nil { | ||
rowStyle = m.CustomRowStyle.Style(rowID, m.rows[rowID]) | ||
} else { | ||
// We don't have rowstyle separately, what now? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is worth having a field in Styles
for Row
, this would make this chunk a lot simpler
selStyle = m.styles.Selected | ||
} | ||
} else { | ||
selStyle = lipgloss.NewStyle() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does this do?
Hey @pja237, thanks so much for this contribution. Our plan is to replace the table renderer with Lip Gloss tables which will allow fully customizable Cell and Row styles with the I am going to close this PR for now (doing some cleaning up) but feel free to re-open this or create new issues / PRs if needed! |
Here is the Lip Gloss table documentation for reference: https://github.com/charmbracelet/lipgloss/tree/master?tab=readme-ov-file#rendering-tables |
@jlec et al.
PR regarding #246
This was an idea of how one might extend the table styling without causing too much havoc in the table code and to maintain backwards compatibility.
I'm more then happy to receive feedback, ideas and pointers on how to make this better and eventually merged.