Skip to content
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

Table border style now has multiple colors and selectors #327

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

fbernardo
Copy link

It is now possible to pass multiple border styles to a table border style by passing an array with selectors and colors.
Also added new convinience table border selectors for selecting the first row or every other inside border.

Here's an example:

MarkdownUI.Theme()
.table { configuration in
        configuration.label
            .markdownTableBackgroundStyle(.init(background: { row, column in
                row == 0 ? .blue : .clear
            }))
            .markdownTableBorderStyle(
                TableBorderStyle([ // <----- It is now possible to pass an array here.
                    .init(visibleBorders: .insideBordersFirstRow, color: .green),
                    .init(visibleBorders: .insideBordersExceptFirstRow, color: .red)
                ], strokeStyle: .init(lineWidth: 1))
            )
            .clipShape(RoundedRectangle(cornerRadius: 10, style: .continuous))
            .overlay(
                RoundedRectangle(cornerRadius: 10, style: .continuous)
                .strokeBorder(.black, lineWidth: 1)
            )
    }
    .tableCell { configuration in
        configuration.label
            .markdownTextStyle {
                if configuration.row == 0 {
                    ForegroundColor(.white)
                }
            }
            .padding(.vertical, 6)
            .padding(.horizontal, 6)
    }

CleanShot 2024-06-11 at 23 47 58@2x

fbernardo and others added 2 commits June 11, 2024 23:42
Introduced new convinience table border selectors for selecting the first row or every other inside border.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant