Skip to content

Commit cefd25e

Browse files
committed
style(docs): Refine safety badges — matte palette, emoji icons, sidebar dots
why: Expert UX feedback identified badges as too loud, emoji as muddy (grayscale filter), and vertical centering as broken (baseline math). what: - Drop grayscale filter and emoji font-family override — let OS render natively, use opacity: none (emoji are subdued enough at small size) - Matte color palette: forest green, smoky amber, matte crimson with 1px border for dark-theme definition - Heading flex alignment: h2/h3/h4:has(.sd-badge) centers badge against cap-height instead of fighting baseline math - Context-aware sizing: heading badges slightly larger, inline smaller - Sidebar TOC: badges compress to colored dots (no emoji carnival) - Emoji picks: 🔍 readonly, ✏️ mutating, 💣 destructive - Tighter padding, crisper radius, reduced font weight (650 not 700)
1 parent 7b802ee commit cefd25e

1 file changed

Lines changed: 111 additions & 12 deletions

File tree

docs/_static/css/custom.css

Lines changed: 111 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -234,26 +234,102 @@ img[src*="codecov.io"] {
234234
}
235235

236236
/* ── MCP Tool safety badges ──────────────────────────────
237-
* Badges appear inline in both h2/h3 headings and body text.
238-
* Pin size to body-text scale so they don't inflate in headings.
239-
* Vertical-align keeps them centered with adjacent text.
237+
* Small semantic tags — secondary to the tool name, quietly
238+
* color-coded. Target: GitHub-label density, not app-store pills.
240239
*
241-
* Links containing badges: underline only the code text, not
242-
* the gap or badge itself. Achieved by moving text-decoration
243-
* from the <a> to its <code> child.
240+
* Dot icon via ::before circle. No emoji.
241+
* Sidebar/TOC compresses badges to colored dots only.
244242
* ────────────────────────────────────────────────────────── */
243+
244+
/* ── Heading flex alignment ──────────────────────────────
245+
* Makes headings containing badges into flex rows so the
246+
* badge vertically centers against the heading cap-height
247+
* instead of fighting baseline math.
248+
* ────────────────────────────────────────────────────────── */
249+
h2:has(> .sd-badge),
250+
h3:has(> .sd-badge),
251+
h4:has(> .sd-badge) {
252+
display: inline-flex;
253+
align-items: center;
254+
gap: 0.45rem;
255+
}
256+
257+
/* ── Base badge ─────────────────────────────────────────── */
245258
.sd-badge {
246-
font-size: 0.75rem;
247-
vertical-align: middle;
248-
user-select: none; /* Don't include badge text when copying */
249-
-webkit-user-select: none; /* Safari */
259+
display: inline-flex !important;
260+
align-items: center;
261+
gap: 0.28rem;
262+
font-size: 0.67rem;
263+
font-weight: 650;
264+
line-height: 1;
265+
letter-spacing: 0.01em;
266+
padding: 0.16rem 0.38rem;
267+
border-radius: 0.22rem;
268+
user-select: none;
269+
-webkit-user-select: none;
270+
}
271+
272+
/* ── Matte color palette ────────────────────────────────── */
273+
.sd-badge.sd-bg-success {
274+
background-color: #1f7a3f !important;
275+
color: #f3fff7 !important;
276+
border: 1px solid #2a8d4d;
250277
}
251278

252279
.sd-badge.sd-bg-warning {
253-
background-color: #e67e22 !important;
254-
color: #fff !important;
280+
background-color: #b96a1a !important;
281+
color: #fff8ef !important;
282+
border: 1px solid #cf7a23;
283+
}
284+
285+
.sd-badge.sd-bg-danger {
286+
background-color: #b4232c !important;
287+
color: #fff5f5 !important;
288+
border: 1px solid #cb3640;
255289
}
256290

291+
/* ── Monochrome icons via VS15 (text presentation) ──────
292+
* \FE0E (VS15) tells the OS to render the text/outline
293+
* variant instead of the color bitmap. The glyph inherits
294+
* currentColor — no opacity hack, no grayscale filter.
295+
*
296+
* Picks: geometrically simple glyphs with strong text-style
297+
* variants. ⚡ replaces 💥 (too much detail at small sizes).
298+
* ────────────────────────────────────────────────────────── */
299+
.sd-badge::before {
300+
font-style: normal;
301+
font-weight: normal;
302+
font-size: 1em;
303+
line-height: 1;
304+
flex-shrink: 0;
305+
}
306+
307+
.sd-badge.sd-bg-success::before { content: "🔍"; } /* readonly */
308+
.sd-badge.sd-bg-warning::before { content: "✏️"; } /* mutating */
309+
.sd-badge.sd-bg-danger::before { content: "💣"; } /* destructive */
310+
311+
/* ── Context-aware badge sizing ─────────────────────────── */
312+
h2 .sd-badge,
313+
h3 .sd-badge {
314+
font-size: 0.68rem;
315+
padding: 0.17rem 0.4rem;
316+
}
317+
318+
p .sd-badge,
319+
li .sd-badge,
320+
td .sd-badge,
321+
a .sd-badge {
322+
font-size: 0.62rem;
323+
padding: 0.12rem 0.32rem;
324+
}
325+
326+
/* ── Consistent code → badge spacing ────────────────────── */
327+
code.docutils + .sd-badge,
328+
.sd-badge + code.docutils {
329+
margin-left: 0.4em;
330+
}
331+
332+
/* ── Link behavior: underline code only, on hover ───────── */
257333
a.reference .sd-badge {
258334
text-decoration: none;
259335
}
@@ -269,3 +345,26 @@ a.reference:has(.sd-badge) code {
269345
a.reference:has(.sd-badge):hover code {
270346
text-decoration: underline;
271347
}
348+
349+
/* ── Sidebar TOC: compress badges to colored dots ───────── */
350+
.toc-tree .sd-badge {
351+
color: transparent !important;
352+
padding: 0;
353+
width: 0.5rem;
354+
height: 0.5rem;
355+
border-radius: 999px;
356+
overflow: hidden;
357+
font-size: 0;
358+
gap: 0;
359+
border: none;
360+
}
361+
362+
.toc-tree .sd-badge::before {
363+
content: "";
364+
width: 0.5rem;
365+
height: 0.5rem;
366+
border-radius: 50%;
367+
background: currentColor;
368+
opacity: 1;
369+
font-size: 0;
370+
}

0 commit comments

Comments
 (0)