Skip to content

Commit

Permalink
docs: add dark mode
Browse files Browse the repository at this point in the history
  • Loading branch information
laurenceisla committed Feb 27, 2024
1 parent 2479e0d commit 51b18f4
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"sphinx_tabs.tabs",
"sphinx_copybutton",
"sphinxext.opengraph",
"sphinx_rtd_dark_mode",
]

# Add any paths that contain templates here, relative to this directory.
Expand Down Expand Up @@ -301,6 +302,9 @@ def setup(app):
# sphinx-tabs configuration
sphinx_tabs_disable_tab_closing = True

# sphinx_rtd_dark_mode configuration
default_dark_mode = False

# sphinxext-opengraph configuration

ogp_image = "_images/logo.png"
Expand Down
29 changes: 29 additions & 0 deletions nix/docs-extensions/sphinx-rtd-dark-mode.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{ lib
, buildPythonPackage
, fetchPypi
, sphinx
}:

buildPythonPackage rec {
pname = "sphinx_rtd_dark_mode";
version = "1.3.0";

src = fetchPypi {
inherit pname version;
sha256 = "sha256-AnK/PZ72IJIa3GflY0pmlpQZ50TahOoYgwraz9sWDqg=";
};

propagatedBuildInputs = [
sphinx
];

doCheck = false;

pythonImportsCheck = [ "sphinx_rtd_dark_mode" ];

meta = with lib; {
description = "Dark mode for the Sphinx Read the Docs theme";
homepage = "https://github.com/MrDogeBro/sphinx_rtd_dark_mode";
license = licenses.mit;
};
}
1 change: 1 addition & 0 deletions nix/tools/docs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ let
ps.sphinx-tabs
ps.sphinx-copybutton
ps.sphinxext-opengraph
(ps.callPackage ../docs-extensions/sphinx-rtd-dark-mode.nix {})
# TODO: Remove override once new sphinx-intl version (> 2.1.0) is released and available in nixpkgs
(ps.sphinx-intl.overrideAttrs (drv: { nativeBuildInputs = drv.nativeBuildInputs ++ [ ps.six ]; }))
];
Expand Down

0 comments on commit 51b18f4

Please sign in to comment.