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

Centering the Title #96

Closed
ogazitt opened this issue Apr 15, 2020 · 2 comments
Closed

Centering the Title #96

ogazitt opened this issue Apr 15, 2020 · 2 comments

Comments

@ogazitt
Copy link

ogazitt commented Apr 15, 2020

Describe the bug
Thanks for the great library!

The color table [1] implies that the title string can be centered.

I found the SetTitle function, which takes a format string as its first argument, so if I know the terminal width, I could presumably use sprintf-style formatting... but is that a property I can grab?

Or is there an easier way of centering the title string?

Thanks again for the great library!

[1] https://github.com/jedib0t/go-pretty/blob/master/cmd/demo-table/demo-colors.png

@ogazitt
Copy link
Author

ogazitt commented Apr 18, 2020

found an example in cmd/demo-table/demo.go

t.Style().Title.Align = text.AlignCenter

@ogazitt ogazitt closed this as completed Apr 18, 2020
@jedib0t
Copy link
Owner

jedib0t commented May 7, 2020

Awesome!!! Thanks for self resolving this!

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

No branches or pull requests

2 participants