Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.