diff --git a/docs/_static/custom-icon.js b/docs/_static/custom-icon.js new file mode 100644 index 000000000..cd949b3b7 --- /dev/null +++ b/docs/_static/custom-icon.js @@ -0,0 +1,16 @@ +/******************************************************************************* + * Set a custom icon for pypi as it's not available in the fa built-in brands + */ +FontAwesome.library.add( + (faListOldStyle = { + prefix: "fa-custom", + iconName: "pypi", + icon: [ + 17.313, // viewBox width + 19.807, // viewBox height + [], // ligature + "e001", // unicode codepoint - private use area + "m10.383 0.2-3.239 1.1769 3.1883 1.1614 3.239-1.1798zm-3.4152 1.2411-3.2362 1.1769 3.1855 1.1614 3.2369-1.1769zm6.7177 0.00281-3.2947 1.2009v3.8254l3.2947-1.1988zm-3.4145 1.2439-3.2926 1.1981v3.8254l0.17548-0.064132 3.1171-1.1347zm-6.6564 0.018325v3.8247l3.244 1.1805v-3.8254zm10.191 0.20931v2.3137l3.1777-1.1558zm3.2947 1.2425-3.2947 1.1988v3.8254l3.2947-1.1988zm-8.7058 0.45739c0.00929-1.931e-4 0.018327-2.977e-4 0.027485 0 0.25633 0.00851 0.4263 0.20713 0.42638 0.49826 1.953e-4 0.38532-0.29327 0.80469-0.65542 0.93662-0.36226 0.13215-0.65608-0.073306-0.65613-0.4588-6.28e-5 -0.38556 0.2938-0.80504 0.65613-0.93662 0.068422-0.024919 0.13655-0.038114 0.20156-0.039466zm5.2913 0.78369-3.2947 1.1988v3.8247l3.2947-1.1981zm-10.132 1.239-3.2362 1.1769 3.1883 1.1614 3.2362-1.1769zm6.7177 0.00213-3.2926 1.2016v3.8247l3.2926-1.2009zm-3.4124 1.2439-3.2947 1.1988v3.8254l3.2947-1.1988zm-6.6585 0.016195v3.8275l3.244 1.1805v-3.8254zm16.9 0.21143-3.2947 1.1988v3.8247l3.2947-1.1981zm-3.4145 1.2411-3.2926 1.2016v3.8247l3.2926-1.2009zm-3.4145 1.2411-3.2926 1.2016v3.8247l3.2926-1.2009zm-3.4124 1.2432-3.2947 1.1988v3.8254l3.2947-1.1988zm-6.6585 0.019027v3.8247l3.244 1.1805v-3.8254zm13.485 1.4497-3.2947 1.1988v3.8247l3.2947-1.1981zm-3.4145 1.2411-3.2926 1.2016v3.8247l3.2926-1.2009zm2.4018 0.38127c0.0093-1.83e-4 0.01833-3.16e-4 0.02749 0 0.25633 0.0085 0.4263 0.20713 0.42638 0.49826 1.97e-4 0.38532-0.29327 0.80469-0.65542 0.93662-0.36188 0.1316-0.65525-0.07375-0.65542-0.4588-1.95e-4 -0.38532 0.29328-0.80469 0.65542-0.93662 0.06842-0.02494 0.13655-0.03819 0.20156-0.03947zm-5.8142 0.86403-3.244 1.1805v1.4201l3.244 1.1805z", // svg path (https://simpleicons.org/icons/pypi.svg) + ], + }) +); diff --git a/docs/conf.py b/docs/conf.py index f33cf1eb3..aeac8f200 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -128,14 +128,22 @@ "name": "Donate to NumFocus", }, ], - "github_url": "https://github.com/pydata/pydata-sphinx-theme", - "twitter_url": "https://twitter.com/PyData", "header_links_before_dropdown": 4, "icon_links": [ + { + "name": "Twitter", + "url": "https://twitter.com/PyData", + "icon": "fa-brands fa-twitter", + }, + { + "name": "GitHub", + "url": "https://github.com/pydata/pydata-sphinx-theme", + "icon": "fa-brands fa-github", + }, { "name": "PyPI", "url": "https://pypi.org/project/pydata-sphinx-theme", - "icon": "fa-solid fa-box", + "icon": "fa-custom fa-pypi", }, { "name": "PyData", @@ -145,6 +153,9 @@ "attributes": {"target": "_blank"}, }, ], + # alternative way to set twitter and github header icons + # "github_url": "https://github.com/pydata/pydata-sphinx-theme", + # "twitter_url": "https://twitter.com/PyData", "logo": { "text": "PyData Theme", "image_dark": "_static/logo-dark.svg", @@ -208,6 +219,7 @@ # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ["_static"] html_css_files = ["custom.css"] +html_js_files = ["custom-icon.js"] todo_include_todos = True # -- favicon options --------------------------------------------------------- diff --git a/src/pydata_sphinx_theme/assets/styles/components/_switcher-theme.scss b/src/pydata_sphinx_theme/assets/styles/components/_switcher-theme.scss index 0f3938386..872e8f192 100644 --- a/src/pydata_sphinx_theme/assets/styles/components/_switcher-theme.scss +++ b/src/pydata_sphinx_theme/assets/styles/components/_switcher-theme.scss @@ -1,43 +1,21 @@ // the icons for theme change .theme-switch-button { - // override bootstrap settings - border-color: var(--pst-color-on-background); - // Size is a bit smaller because the background shadow is bigger - font-size: calc(var(--pst-font-size-icon) - 0.1rem); + // overide bootstrap settings margin: 0 -0.5rem; padding: 0; // We pad the `span` not the container + color: var(--pst-color-text-muted); span { display: none; - color: var(--pst-color-text-muted); - padding: 0.5rem; + padding: 0.5em; + &:hover, &:active, &:focus { text-decoration: none; + color: var(--pst-color-primary); } } - - &:hover, - &:active { - // override bootstrap settings - background-color: var(--pst-color-on-surface) !important; - border-color: var(--pst-color-on-background) !important; - a { - color: var(--pst-color-text-muted); - } - } -} - -// specific border color when the button is nested in the navbar -// as it's color is different from the header -.bd-sidebar-primary .theme-switch-button { - border-color: var(--pst-color-background); - - &:hover, - &:active { - border-color: var(--pst-color-background) !important; - } } html[data-mode="auto"] .theme-switch-button span[data-mode="auto"] { diff --git a/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/icon-links.html b/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/icon-links.html index 78c595b9e..33371c50b 100644 --- a/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/icon-links.html +++ b/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/icon-links.html @@ -12,7 +12,7 @@ {% set attributeString = attributeString | join(" ") -%} {%- if type == "fontawesome" -%} - + {%- elif type == "local" -%} {{ name }} diff --git a/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/search-button.html b/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/search-button.html index 76fc231f9..05529b687 100644 --- a/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/search-button.html +++ b/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/search-button.html @@ -5,7 +5,7 @@ diff --git a/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/theme-switcher.html b/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/theme-switcher.html index 63c8cd239..49cd6f900 100644 --- a/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/theme-switcher.html +++ b/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/theme-switcher.html @@ -2,10 +2,10 @@ #} diff --git a/tests/test_build/navbar_icon_links.html b/tests/test_build/navbar_icon_links.html index 49b2624cf..1828321d4 100644 --- a/tests/test_build/navbar_icon_links.html +++ b/tests/test_build/navbar_icon_links.html @@ -2,7 +2,7 @@