diff --git a/docs/_static/style.css b/docs/_static/style.css
index b55443da3..b42664649 100644
--- a/docs/_static/style.css
+++ b/docs/_static/style.css
@@ -74,6 +74,9 @@ Historically however, thanks to:
--active-toc: #dbdbdb;
--scrollbar: rgba(0,0,0,0.2);
--scrollbar-hover: rgba(0,0,0,0.4);
+ --rtd-ad-border: #bfbfbf;
+ --rtd-ad-background: #eeeeee;
+ --rtd-ad-text-rgb: 64, 64, 64;
}
:root[data-font="sans"] {
@@ -124,6 +127,9 @@ Historically however, thanks to:
--active-toc: #212121;
--scrollbar: rgba(0,0,0,0.5);
--scrollbar-hover: rgba(0,0,0,0.7);
+ --rtd-ad-border: #333333;
+ --rtd-ad-background: #404040;
+ --rtd-ad-text-rgb: 221, 221, 221;
}
img[src$="snake_dark.svg"] {
@@ -844,6 +850,21 @@ section#welcome-to-discord-py > h1 {
display: none;
}
+/* make the RTD ad look a little less jarring */
+
+.ethical-fixedfooter {
+ background-color: var(--rtd-ad-background) !important;
+ border-top: 1px solid var(--rtd-ad-border) !important;
+}
+
+.ethical-fixedfooter a {
+ color: rgb(var(--rtd-ad-text-rgb)) !important;
+}
+
+.ethical-callout a {
+ color: rgba(var(--rtd-ad-text-rgb), 0.7) !important;
+}
+
.active {
background-color: var(--mobile-active-toc);
border-left: 5px solid var(--mobile-active-toc);
diff --git a/docs/_templates/layout.html b/docs/_templates/layout.html
index 0af79f915..236f5446d 100644
--- a/docs/_templates/layout.html
+++ b/docs/_templates/layout.html
@@ -4,6 +4,8 @@
{{ title|striptags|e }}{{ titlesuffix }}
+ {%- block extrahead %} {% endblock %}
+
@@ -48,7 +50,6 @@
{%- endif %}
{%- endblock %}
- {%- block extrahead %} {% endblock %}
{%- block header %}{% endblock %}
diff --git a/docs/extensions/builder.py b/docs/extensions/builder.py
index 96c7d0a5b..7662ee491 100644
--- a/docs/extensions/builder.py
+++ b/docs/extensions/builder.py
@@ -48,18 +48,20 @@ def add_custom_jinja2(app):
env.tests['prefixedwith'] = str.startswith
env.tests['suffixedwith'] = str.endswith
-def get_builder(app):
+def add_builders(app):
"""This is necessary because RTD injects their own for some reason."""
try:
original = app.registry.builders['readthedocs']
except KeyError:
- return DPYStandaloneHTMLBuilder
+ app.set_translator('html', DPYHTML5Translator, override=True)
+ app.add_builder(DPYStandaloneHTMLBuilder, override=True)
else:
injected_mro = tuple(base if base is not StandaloneHTMLBuilder else DPYStandaloneHTMLBuilder
for base in original.mro()[1:])
- return type(original.__name__, injected_mro, {'name': 'readthedocs'})
+ new_builder = type(original.__name__, injected_mro, {'name': 'readthedocs'})
+ app.set_translator('readthedocs', DPYHTML5Translator, override=True)
+ app.add_builder(new_builder, override=True)
def setup(app):
- app.set_translator('html', DPYHTML5Translator, override=True)
- app.add_builder(get_builder(app), override=True)
+ add_builders(app)
app.connect('builder-inited', add_custom_jinja2)