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

How to style stub? #385

Open
dafriedman97 opened this issue Jun 27, 2024 · 1 comment
Open

How to style stub? #385

dafriedman97 opened this issue Jun 27, 2024 · 1 comment

Comments

@dafriedman97
Copy link

Is it possible to add styling in the stub? I can style a regular column like this:

from great_tables import GT, md, html, style, loc
from great_tables.data import islands

islands_mini = islands.head(5)
(
    GT(islands_mini)
    .tab_stub(rowname_col="name")
    .tab_style(
        style=style.fill('lightgray'),
        locations=loc.body(columns=['size'])
    )
)
image

But how could I style the stub group (i.e. make the geographical names colored)?

@jrycw
Copy link
Contributor

jrycw commented Jul 1, 2024

@dafriedman97, maybe try using tab_options:

from great_tables import GT, loc, style
from great_tables.data import islands

islands_mini = islands.head(5)
(
    GT(islands_mini)
    .tab_stub(rowname_col="name")
    .tab_style(style=style.fill("lightgray"), locations=loc.body(columns=["size"]))
    .tab_options(stub_background_color="lightgreen")
)

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants