Skip to content

Commit a72447d

Browse files
authored
Merge pull request #3272 from davidekete/admonition-patch
update css to account for dark mode in admonitions
2 parents 8fb79d7 + a05cd8e commit a72447d

File tree

2 files changed

+172
-1
lines changed

2 files changed

+172
-1
lines changed

docs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ general-checks: vale-install
139139
@. $(VENV); vale --minAlertLevel=error --filter='.Extends!="spelling"' --config=$(VALE_CONFIG) $(SOURCEDIR)/*.md
140140

141141
clean:
142-
rm -rf $(BUILDDIR)/*
142+
rm -rf $(BUILDDIR)/dirhtml && rm -rf $(BUILDDIR)/doctrees
143143

144144
html:
145145
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html

docs/_static/css/custom.css

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,3 +1013,174 @@ span.fa.fa-book {
10131013
.plugin-card a.stretched-link {
10141014
z-index: 1;
10151015
}
1016+
1017+
/* === DARK MODE === */
1018+
html[style*="--color-scheme: dark"] .rst-content .admonition.note,
1019+
html[style*="--color-scheme: dark"] .wy-alert.note {
1020+
background: rgba(79, 156, 255, 0.04) !important;
1021+
border: 1px solid rgba(79, 156, 255, 0.35) !important;
1022+
}
1023+
html[style*="--color-scheme: dark"]
1024+
.rst-content
1025+
.admonition.note
1026+
> .admonition-title,
1027+
html[style*="--color-scheme: dark"] .wy-alert.note > .wy-alert-title {
1028+
background: rgba(79, 156, 255, 0.3) !important;
1029+
color: #fff !important;
1030+
}
1031+
1032+
html[style*="--color-scheme: dark"] .rst-content .admonition.tip,
1033+
html[style*="--color-scheme: dark"] .wy-alert.tip {
1034+
background: rgba(60, 190, 120, 0.04) !important;
1035+
border: 1px solid rgba(60, 190, 120, 0.35) !important;
1036+
}
1037+
html[style*="--color-scheme: dark"]
1038+
.rst-content
1039+
.admonition.tip
1040+
> .admonition-title,
1041+
html[style*="--color-scheme: dark"] .wy-alert.tip > .wy-alert-title {
1042+
background: rgba(60, 190, 120, 0.3) !important;
1043+
color: #fff !important;
1044+
}
1045+
1046+
html[style*="--color-scheme: dark"] .rst-content .admonition.warning,
1047+
html[style*="--color-scheme: dark"] .wy-alert.warning {
1048+
background: rgba(255, 171, 64, 0.04) !important;
1049+
border: 1px solid rgba(255, 171, 64, 0.4) !important;
1050+
}
1051+
html[style*="--color-scheme: dark"]
1052+
.rst-content
1053+
.admonition.warning
1054+
> .admonition-title,
1055+
html[style*="--color-scheme: dark"] .wy-alert.warning > .wy-alert-title {
1056+
background: rgba(255, 171, 64, 0.3) !important;
1057+
color: #fff !important;
1058+
}
1059+
1060+
html[style*="--color-scheme: dark"] .rst-content .admonition.danger,
1061+
html[style*="--color-scheme: dark"] .rst-content .admonition.error,
1062+
html[style*="--color-scheme: dark"] .wy-alert.danger {
1063+
background: rgba(255, 82, 82, 0.035) !important;
1064+
border: 1px solid rgba(255, 82, 82, 0.4) !important;
1065+
}
1066+
html[style*="--color-scheme: dark"]
1067+
.rst-content
1068+
.admonition.danger
1069+
> .admonition-title,
1070+
html[style*="--color-scheme: dark"]
1071+
.rst-content
1072+
.admonition.error
1073+
> .admonition-title,
1074+
html[style*="--color-scheme: dark"] .wy-alert.danger > .wy-alert-title {
1075+
background: rgba(255, 82, 82, 0.28) !important;
1076+
color: #fff !important;
1077+
}
1078+
1079+
/* fallback for generic .admonition with no extra class */
1080+
html[style*="--color-scheme: dark"]
1081+
.rst-content
1082+
.admonition:not([class*="note"]):not([class*="tip"]):not(
1083+
[class*="warning"]
1084+
):not([class*="danger"]):not([class*="error"]),
1085+
html[style*="--color-scheme: dark"]
1086+
.wy-alert:not(.note):not(.tip):not(.warning):not(.danger) {
1087+
background: rgba(255, 255, 255, 0.03) !important;
1088+
border: 1px solid rgba(255, 255, 255, 0.12) !important;
1089+
}
1090+
html[style*="--color-scheme: dark"]
1091+
.rst-content
1092+
.admonition:not([class*="note"]):not([class*="tip"]):not(
1093+
[class*="warning"]
1094+
):not([class*="danger"]):not([class*="error"])
1095+
> .admonition-title,
1096+
html[style*="--color-scheme: dark"]
1097+
.wy-alert:not(.note):not(.tip):not(.warning):not(.danger)
1098+
> .wy-alert-title {
1099+
background: rgba(85, 165, 217, 0.35) !important;
1100+
color: #fff !important;
1101+
}
1102+
1103+
/* === BLACK MODE === */
1104+
html[style*="--color-scheme: black"] .rst-content .admonition.note,
1105+
html[style*="--color-scheme: black"] .wy-alert.note {
1106+
background: rgba(79, 156, 255, 0.035) !important;
1107+
border: 1px solid rgba(79, 156, 255, 0.3) !important;
1108+
}
1109+
html[style*="--color-scheme: black"]
1110+
.rst-content
1111+
.admonition.note
1112+
> .admonition-title,
1113+
html[style*="--color-scheme: black"] .wy-alert.note > .wy-alert-title {
1114+
background: rgba(79, 156, 255, 0.25) !important;
1115+
color: #fff !important;
1116+
}
1117+
1118+
html[style*="--color-scheme: black"] .rst-content .admonition.tip,
1119+
html[style*="--color-scheme: black"] .wy-alert.tip {
1120+
background: rgba(60, 190, 120, 0.035) !important;
1121+
border: 1px solid rgba(60, 190, 120, 0.3) !important;
1122+
}
1123+
html[style*="--color-scheme: black"]
1124+
.rst-content
1125+
.admonition.tip
1126+
> .admonition-title,
1127+
html[style*="--color-scheme: black"] .wy-alert.tip > .wy-alert-title {
1128+
background: rgba(60, 190, 120, 0.25) !important;
1129+
color: #fff !important;
1130+
}
1131+
1132+
html[style*="--color-scheme: black"] .rst-content .admonition.warning,
1133+
html[style*="--color-scheme: black"] .wy-alert.warning {
1134+
background: rgba(255, 171, 64, 0.035) !important;
1135+
border: 1px solid rgba(255, 171, 64, 0.35) !important;
1136+
}
1137+
html[style*="--color-scheme: black"]
1138+
.rst-content
1139+
.admonition.warning
1140+
> .admonition-title,
1141+
html[style*="--color-scheme: black"] .wy-alert.warning > .wy-alert-title {
1142+
background: rgba(255, 171, 64, 0.24) !important;
1143+
color: #fff !important;
1144+
}
1145+
1146+
html[style*="--color-scheme: black"] .rst-content .admonition.danger,
1147+
html[style*="--color-scheme: black"] .rst-content .admonition.error,
1148+
html[style*="--color-scheme: black"] .wy-alert.danger {
1149+
background: rgba(255, 82, 82, 0.03) !important;
1150+
border: 1px solid rgba(255, 82, 82, 0.35) !important;
1151+
}
1152+
html[style*="--color-scheme: black"]
1153+
.rst-content
1154+
.admonition.danger
1155+
> .admonition-title,
1156+
html[style*="--color-scheme: black"]
1157+
.rst-content
1158+
.admonition.error
1159+
> .admonition-title,
1160+
html[style*="--color-scheme: black"] .wy-alert.danger > .wy-alert-title {
1161+
background: rgba(255, 82, 82, 0.22) !important;
1162+
color: #fff !important;
1163+
}
1164+
1165+
html[style*="--color-scheme: black"]
1166+
.rst-content
1167+
.admonition:not([class*="note"]):not([class*="tip"]):not(
1168+
[class*="warning"]
1169+
):not([class*="danger"]):not([class*="error"]),
1170+
html[style*="--color-scheme: black"]
1171+
.wy-alert:not(.note):not(.tip):not(.warning):not(.danger) {
1172+
background: rgba(255, 255, 255, 0.03) !important;
1173+
border: 1px solid rgba(255, 255, 255, 0.12) !important;
1174+
}
1175+
html[style*="--color-scheme: black"]
1176+
.rst-content
1177+
.admonition:not([class*="note"]):not([class*="tip"]):not(
1178+
[class*="warning"]
1179+
):not([class*="danger"]):not([class*="error"])
1180+
> .admonition-title,
1181+
html[style*="--color-scheme: black"]
1182+
.wy-alert:not(.note):not(.tip):not(.warning):not(.danger)
1183+
> .wy-alert-title {
1184+
background: rgba(85, 165, 217, 0.3) !important;
1185+
color: #fff !important;
1186+
}

0 commit comments

Comments
 (0)