tommilligan / mdbook-admonish

A preprocessor for mdbook to add Material Design admonishments.
MIT License
171 stars 18 forks source link

Admonish looks weird with the Rust theme #172

Open meator opened 5 months ago

meator commented 5 months ago

This might not be a bug. But I find it weird.

screenshot

I have created a book based off of https://rust-lang.github.io/mdBook/format/markdown.html which should show all of the distinct elements mdBook can render. It can be found here: book.tar.gz

It shows that no other element is using such dark colors in the body of the page with the Rust theme. This makes the admonish notes pretty disruptive. All of the notes immediately stand out from the page, even though they should just be additional informative notes (or something else).

tommilligan commented 5 months ago

Agreed this doesn't look great - happy for some alternative that doesn't create such a high contrast element.

I'm aware of this as we use the theme CSS variables to do the styling, which in this case are

.rust :is(.admonition) {
    background-color: var(--sidebar-bg);
    color: var(--sidebar-fg);
}

image

Honestly IMO the easiest thing might be to just add a hardcoded special case for the rust theme because it's pretty weird compared to the others - this high contrast is kind of a feature of the theme, but I agree how we're using it doesn't look good.

The place to start investigating that would be here - actually looks like we already have a bunch of overrides specifically for Rust, so maybe just hardcoding some hex values is fine: https://github.com/tommilligan/mdbook-admonish/blob/85fde44c0994214b894c5aa2c9814a6e4e7411fc/compile_assets/scss/admonition.scss#L255