Skip to content

Commit 570b1cc

Browse files
committed
badges+fastmcp(css): Subtle buffed-pill inset shadow on solid badges
why: Colored pills read flat on white page backgrounds; light top highlight and soft inner shade add depth without heavy skeuomorphism. what: - :root --sab-buff-shadow / --sab-buff-shadow-dark-ui in sphinx_autodoc_badges - Apply to .sab-badge excluding outline and inline-icon variants - Mirror with !important on FastMCP safety/type rules for load-order parity
1 parent 498ab75 commit 570b1cc

2 files changed

Lines changed: 40 additions & 0 deletions

File tree

packages/sphinx-autodoc-badges/src/sphinx_autodoc_badges/_static/css/sphinx_autodoc_badges.css

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@
55
* (--sab-bg, --sab-fg, --sab-border).
66
*/
77

8+
:root {
9+
/* Subtle “buffed pill”: top highlight + soft inner shade (light UI / white page bg) */
10+
--sab-buff-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2),
11+
inset 0 -1px 2px rgba(0, 0, 0, 0.12);
12+
--sab-buff-shadow-dark-ui: inset 0 1px 0 rgba(255, 255, 255, 0.1),
13+
inset 0 -1px 2px rgba(0, 0, 0, 0.28);
14+
}
15+
816
/* ── Base badge ─────────────────────────────────────────── */
917
.sab-badge {
1018
display: inline-flex;
@@ -30,6 +38,20 @@
3038
box-sizing: border-box;
3139
}
3240

41+
.sab-badge:not(.sab-outline):not(.sab-inline-icon) {
42+
box-shadow: var(--sab-buff-shadow);
43+
}
44+
45+
@media (prefers-color-scheme: dark) {
46+
body:not([data-theme="light"]) .sab-badge:not(.sab-outline):not(.sab-inline-icon) {
47+
box-shadow: var(--sab-buff-shadow-dark-ui);
48+
}
49+
}
50+
51+
body[data-theme="dark"] .sab-badge:not(.sab-outline):not(.sab-inline-icon) {
52+
box-shadow: var(--sab-buff-shadow-dark-ui);
53+
}
54+
3355
.sab-badge:focus-visible {
3456
outline: 2px solid var(--color-link, #2962ff);
3557
outline-offset: 2px;

packages/sphinx-autodoc-fastmcp/src/sphinx_autodoc_fastmcp/_static/css/sphinx_autodoc_fastmcp.css

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,35 +93,53 @@ h4.smf-tool-title .sab-badge.smf-badge--type,
9393
background-color: #1f7a3f !important;
9494
color: #f3fff7 !important;
9595
border: 1px solid #2a8d4d !important;
96+
box-shadow: var(--sab-buff-shadow) !important;
9697
}
9798

9899
.sab-badge.smf-safety-mutating:not(.sab-inline-icon) {
99100
background-color: #b96a1a !important;
100101
color: #fff8ef !important;
101102
border: 1px solid #cf7a23 !important;
103+
box-shadow: var(--sab-buff-shadow) !important;
102104
}
103105

104106
.sab-badge.smf-safety-destructive:not(.sab-inline-icon) {
105107
background-color: #b4232c !important;
106108
color: #fff5f5 !important;
107109
border: 1px solid #cb3640 !important;
110+
box-shadow: var(--sab-buff-shadow) !important;
108111
}
109112

110113
/* MCP "tool": white label (never use --sd-color-info-text; it is dark on light teal) */
111114
.sab-badge.smf-type-tool:not(.sab-inline-icon) {
112115
background-color: #0e7490 !important;
113116
color: #ffffff !important;
114117
border: 1px solid #0f766e !important;
118+
box-shadow: var(--sab-buff-shadow) !important;
115119
}
116120

117121
@media (prefers-color-scheme: dark) {
122+
body:not([data-theme="light"]) .sab-badge.smf-safety-readonly:not(.sab-inline-icon),
123+
body:not([data-theme="light"]) .sab-badge.smf-safety-mutating:not(.sab-inline-icon),
124+
body:not([data-theme="light"]) .sab-badge.smf-safety-destructive:not(.sab-inline-icon),
125+
body:not([data-theme="light"]) .sab-badge.smf-type-tool:not(.sab-inline-icon) {
126+
box-shadow: var(--sab-buff-shadow-dark-ui) !important;
127+
}
128+
118129
body:not([data-theme="light"]) .sab-badge.smf-type-tool:not(.sab-inline-icon) {
119130
background-color: #0d9488 !important;
120131
color: #ffffff !important;
121132
border: 1px solid #14b8a6 !important;
122133
}
123134
}
124135

136+
body[data-theme="dark"] .sab-badge.smf-safety-readonly:not(.sab-inline-icon),
137+
body[data-theme="dark"] .sab-badge.smf-safety-mutating:not(.sab-inline-icon),
138+
body[data-theme="dark"] .sab-badge.smf-safety-destructive:not(.sab-inline-icon),
139+
body[data-theme="dark"] .sab-badge.smf-type-tool:not(.sab-inline-icon) {
140+
box-shadow: var(--sab-buff-shadow-dark-ui) !important;
141+
}
142+
125143
body[data-theme="dark"] .sab-badge.smf-type-tool:not(.sab-inline-icon) {
126144
background-color: #0d9488 !important;
127145
color: #ffffff !important;

0 commit comments

Comments
 (0)