Skip to content

Commit 3453e28

Browse files
committed
docs: Add styling for "Deprecated" admonitions
Style the `deprecated` admonition class like a warning, but with the `material/grave-stone` icon and its own colour, so deprecation notices read as deprecation notices and not as generic warnings. That class is what a hand-written `Deprecated:` admonition in a docstring produces, and also what the griffe extension added next will emit, so a single rule covers both sources. Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
1 parent b6226e3 commit 3453e28

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

‎docs/_css/mkdocstrings.css‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,25 @@ a.autorefs-external::after {
4242
a.autorefs-external:hover::after {
4343
background-color: var(--md-accent-fg-color);
4444
}
45+
46+
/* A "Deprecated" admonition, styled like a warning but with its own icon. */
47+
:root {
48+
--md-admonition-icon--deprecated: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10 2h4c3.31 0 5 2.69 5 6v10.66C16.88 17.63 15.07 17 12 17s-4.88.63-7 1.66V8c0-3.31 1.69-6 5-6M8 8v1.5h8V8zm1 4v1.5h6V12zM3 22v-.69c2.66-1.69 10.23-5.47 18-.06V22z"/></svg>');
49+
}
50+
51+
.md-typeset .admonition.deprecated,
52+
.md-typeset details.deprecated {
53+
border-color: #cc9900;
54+
}
55+
56+
.md-typeset .deprecated > .admonition-title,
57+
.md-typeset .deprecated > summary {
58+
background-color: #cc99001a;
59+
}
60+
61+
.md-typeset .deprecated > .admonition-title::before,
62+
.md-typeset .deprecated > summary::before {
63+
background-color: #cc9900;
64+
-webkit-mask-image: var(--md-admonition-icon--deprecated);
65+
mask-image: var(--md-admonition-icon--deprecated);
66+
}

0 commit comments

Comments
 (0)