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

Border color when title is used #234

Closed
alajmo opened this issue Oct 6, 2022 · 3 comments
Closed

Border color when title is used #234

alajmo opened this issue Oct 6, 2022 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@alajmo
Copy link

alajmo commented Oct 6, 2022

Describe the bug
No way to set border style for title.

To Reproduce

package main

import (
    "os"

    "github.com/jedib0t/go-pretty/v6/text"
    "github.com/jedib0t/go-pretty/v6/table"
)

func main() {
    t := table.NewWriter()
    t.SetOutputMirror(os.Stdout)
    t.AppendHeader(table.Row{"#", "First Name", "Last Name", "Salary"})
    t.AppendRows([]table.Row{
        {1, "Arya", "Stark", 3000},
        {20, "Jon", "Snow", 2000, "You know nothing, Jon Snow!"},
    })
    t.AppendSeparator()
    t.AppendRow([]interface{}{300, "Tyrion", "Lannister", 5000})
    t.AppendFooter(table.Row{"", "", "Total", 10000})
    t.SetTitle("title test")
    t.Style().Title.Colors = text.Colors{text.Faint}
    t.Style().Color = table.ColorOptions{
		Header: text.Colors{text.Faint},
		Row: text.Colors{text.Faint},
		RowAlternate: text.Colors{text.Faint},
		Footer: text.Colors{text.Faint},
    }

    t.Render()
}

Expected behavior
I expect to be able to color the top portion of the border.

Screenshots
border

Software (please complete the following information):

  • OS: Linux 5.18.0-2-amd64 Debian 5.18.5-1 (2022-06-16) x86_64 GNU/Linux
  • GoLang Version: go version go1.18 linux/amd64
@jedib0t
Copy link
Owner

jedib0t commented Oct 7, 2022

Ack. This solution for this is part of the solution for #218. Will leave this open just for tracking.

@jedib0t jedib0t self-assigned this Oct 7, 2022
@jedib0t jedib0t added the enhancement New feature or request label Oct 7, 2022
jedib0t added a commit that referenced this issue Nov 6, 2022
@jedib0t jedib0t closed this as completed in 711c5ea Nov 6, 2022
@jedib0t
Copy link
Owner

jedib0t commented Nov 6, 2022

Hey @alajmo ... the other feature may not see the light of the day. So I've delivered a fix for your issue and cut a tag for your use: https://github.com/jedib0t/go-pretty/releases/tag/v6.4.2

@alajmo
Copy link
Author

alajmo commented Nov 7, 2022

Thank you, works wonderfully :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants