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

Modify the table hover attribute #5061

Closed
4 tasks done
santaimpersonator opened this issue Feb 16, 2023 · 2 comments
Closed
4 tasks done

Modify the table hover attribute #5061

santaimpersonator opened this issue Feb 16, 2023 · 2 comments
Labels
change request Issue requests a new feature or improvement resolved Issue is resolved, yet unreleased if open

Comments

@santaimpersonator
Copy link

Context

Modify the background color of a table row when a mouse hovers over a table's row.

Description

When using the default dark color palette, the background color change when hovering over a table's row is almost indistinguishable.

background_color
From the MkDocs-Material documentation

Related links

Use Cases

A white or black color won't work with both colr schemes. However, a nuetral color like yellow or green seems to be fine, with a higher alpha value.

Obviously, a new color variable could be created and called to match each of the light and dark color schemes. However, this seemed like a simple solution to the problem. Plus, the information for this modification could be documented as a stylesheet override in the data table section for users who'd want to customize it.

Visuals

Yellow Modification:

.md-typeset table:not([class]) tbody tr:hover {
    background-color: rgba(255,255,0,.08);
}

background_green

Green Modification:

.md-typeset table:not([class]) tbody tr:hover {
    background-color: rgba(0,255,0,.08);
}

background_yellow

Before submitting

@squidfunk squidfunk added the change request Issue requests a new feature or improvement label Feb 17, 2023
@squidfunk
Copy link
Owner

Thanks for reporting. Fixed in 8796d90. There's now a designated CSS variable which defines the table hover color. The slate color scheme defines a shade that mimics the same intensity as the light scheme now:

Bildschirmfoto 2023-02-18 um 10 56 10

Additionally, if wished, you can now easily override the hover color with additional CSS.

For all color schemes:

[data-md-color-scheme] {
  --md-typeset-table-color--light: rgba(255, 255, 0, .08);
}

For slate color scheme only:

[data-md-color-scheme="slate"] {
  --md-typeset-table-color--light: rgba(255, 255, 0, .08);
}

@squidfunk squidfunk added the resolved Issue is resolved, yet unreleased if open label Feb 18, 2023
@squidfunk
Copy link
Owner

Released as part of 9.0.13.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
change request Issue requests a new feature or improvement resolved Issue is resolved, yet unreleased if open
Projects
None yet
Development

No branches or pull requests

2 participants