-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add dark mode to documentation #1626
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
input[type=checkbox] { | ||
visibility: hidden; | ||
height: 0; | ||
width: 0; | ||
margin: 0; | ||
} | ||
|
||
.rst-versions .rst-current-version { | ||
padding: 10px; | ||
display: flex; | ||
justify-content: space-between; | ||
} | ||
|
||
.rst-versions .rst-current-version .fa-book, | ||
.rst-versions .rst-current-version .fa-v, | ||
.rst-versions .rst-current-version .fa-caret-down { | ||
height: 24px; | ||
line-height: 24px; | ||
vertical-align: middle; | ||
} | ||
|
||
.rst-versions .rst-current-version .fa-element { | ||
width: 80px; | ||
text-align: center; | ||
} | ||
|
||
.rst-versions .rst-current-version .fa-book { | ||
text-align: left; | ||
} | ||
|
||
.rst-versions .rst-current-version .fa-v { | ||
color: #27AE60; | ||
text-align: right; | ||
} | ||
|
||
label { | ||
margin: 0 auto; | ||
display: inline-block; | ||
justify-content: center; | ||
align-items: right; | ||
border-radius: 100px; | ||
position: relative; | ||
cursor: pointer; | ||
text-indent: -9999px; | ||
width: 50px; | ||
height: 21px; | ||
background: #000; | ||
} | ||
|
||
label:after { | ||
border-radius: 50%; | ||
position: absolute; | ||
content: ''; | ||
background: #fff; | ||
width: 15px; | ||
height: 15px; | ||
top: 3px; | ||
left: 3px; | ||
transition: ease-in-out 200ms; | ||
} | ||
|
||
input:checked+label { | ||
background: #3a7ca8; | ||
} | ||
|
||
input:checked+label:after { | ||
left: calc(100% - 5px); | ||
transform: translateX(-100%); | ||
} | ||
|
||
html.transition, | ||
html.transition *, | ||
html.transition *:before, | ||
html.transition *:after { | ||
transition: ease-in-out 200ms !important; | ||
transition-delay: 0 !important; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
document.addEventListener('DOMContentLoaded', function() { | ||
|
||
function toggleCssMode(isDay) { | ||
var mode = (isDay ? "Day" : "Night"); | ||
localStorage.setItem("css-mode", mode); | ||
|
||
var daysheet = $('link[href="_static/pygments.css"]')[0].sheet; | ||
daysheet.disabled = !isDay; | ||
|
||
var nightsheet = $('link[href="_static/css/dark.css"]')[0]; | ||
if (!isDay && nightsheet === undefined) { | ||
var element = document.createElement("link"); | ||
element.setAttribute("rel", "stylesheet"); | ||
element.setAttribute("type", "text/css"); | ||
element.setAttribute("href", "_static/css/dark.css"); | ||
document.getElementsByTagName("head")[0].appendChild(element); | ||
return; | ||
} | ||
if (nightsheet !== undefined) { | ||
nightsheet.sheet.disabled = isDay; | ||
} | ||
} | ||
|
||
var initial = localStorage.getItem("css-mode") != "Night"; | ||
var checkbox = document.querySelector('input[name=mode]'); | ||
|
||
toggleCssMode(initial); | ||
checkbox.checked = initial; | ||
|
||
checkbox.addEventListener('change', function() { | ||
document.documentElement.classList.add('transition'); | ||
window.setTimeout(() => { | ||
document.documentElement.classList.remove('transition'); | ||
}, 1000) | ||
toggleCssMode(this.checked); | ||
}) | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{# Add rst-badge after rst-versions for small badge style. #} | ||
<div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="versions"> | ||
<span class="rst-current-version" data-toggle="rst-current-version"> | ||
<span class="fa fa-book fa-element"> RTD </span> | ||
|
||
<span class="fa fa-element"> | ||
<input class="container_toggle" type="checkbox" id="switch" name="mode"> | ||
<label for="switch"></label> | ||
</span> | ||
|
||
<span class="fa fa-v fa-element"> v: {{ current_version }} <span class="fa fa-caret-down"></span></span> | ||
|
||
</span> | ||
<div class="rst-other-versions"> | ||
<dl> | ||
<dt>{{ _('Versions') }}</dt> {% for slug, url in versions %} | ||
<dd><a href="{{ url }}">{{ slug }}</a></dd> | ||
{% endfor %} | ||
</dl> | ||
<dl> | ||
<dt>{{ _('Downloads') }}</dt> {% for type, url in downloads %} | ||
<dd><a href="{{ url }}">{{ type }}</a></dd> | ||
{% endfor %} | ||
</dl> | ||
<dl> | ||
{# Translators: The phrase "Read the Docs" is not translated #} | ||
<dt>{{ _('On Read the Docs') }}</dt> | ||
<dd> | ||
<a href="//{{ PRODUCTION_DOMAIN }}/projects/{{ slug }}/?fromdocs={{ slug }}">{{ _('Project Home') }}</a> | ||
</dd> | ||
<dd> | ||
<a href="//{{ PRODUCTION_DOMAIN }}/builds/{{ slug }}/?fromdocs={{ slug }}">{{ _('Builds') }}</a> | ||
</dd> | ||
</dl> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,7 +78,7 @@ The ``Package`` class currently verifies the following things. | |
LinkableContract | ||
---------------- | ||
|
||
`Py-EthPM` uses a custom subclass of ``Web3.contract.Contract`` to manage contract factories and instances which might require bytecode linking. To create a deployable contract factory, both the contract type's `abi` and `deployment_bytecode` must be available in the Package's manifest. | ||
`Py-EthPM` uses a custom subclass of ``Web3.contract.Contract`` to manage contract factories and instances which might require bytecode linking. To create a deployable contract factory, both the contract type's ``abi`` and ``deployment_bytecode`` must be available in the Package's manifest. | ||
|
||
.. doctest:: | ||
|
||
|
@@ -132,7 +132,7 @@ Methods | |
|
||
.. py:classmethod:: LinkableContract.link_bytecode(attr_dict) | ||
|
||
This method returns a newly created contract factory with the applied link references defined in the `attr_dict`. This method expects `attr_dict` to be of the type ``Dict[`contract_name`: `address`]`` for all link references that are unlinked. | ||
This method returns a newly created contract factory with the applied link references defined in the ``attr_dict``. This method expects ``attr_dict`` to be of the type ``Dict[`contract_name`: `address`]`` for all link references that are unlinked. | ||
|
||
URI Schemes and Backends | ||
------------------------ | ||
|
@@ -236,13 +236,13 @@ way through the EIP process) | |
- ``version``: The URI escaped version string, *should* conform to the | ||
`semver <http://semver.org/>`__ version numbering specification. | ||
|
||
i.e. | ||
i.e. | ||
- ``ethpm://packages.zeppelinos.eth/[email protected]`` | ||
- ``ethpm://0x808B53bF4D70A24bA5cb720D37A4835621A9df00:1/[email protected]`` | ||
|
||
To specify a specific asset within a package, you can namespace the target asset. | ||
|
||
i.e. | ||
i.e. | ||
- ``ethpm://maker.snakecharmers.eth:1/[email protected]/sources/token.sol`` | ||
- ``ethpm://maker.snakecharmers.eth:1/[email protected]/contract_types/DSToken/abi`` | ||
- ``ethpm://maker.snakecharmers.eth:1/[email protected]/deployments/mainnet/dai`` | ||
|
@@ -391,7 +391,7 @@ To write a manifest to disk | |
Writes the active manifest to disk. Will not overwrite an existing manifest with the same name and root directory. | ||
|
||
Defaults | ||
- Writes manifest to current working directory (as returned by `os.getcwd()`) unless a ``Path`` is provided as manifest_root_dir. | ||
- Writes manifest to current working directory (as returned by ``os.getcwd()``) unless a ``Path`` is provided as manifest_root_dir. | ||
- Writes manifest with a filename of "<version>.json" unless desired manifest name (which must end in ".json") is provided as manifest_name. | ||
- Writes the minified manifest version to disk unless prettify is set to True | ||
|
||
|
@@ -553,7 +553,7 @@ To inline the source code directly in the manifest, use ``inline_source()`` or ` | |
|
||
.. note:: | ||
|
||
`owned_compiler_output.json` below is expected to be the standard-json output generated by the solidity compiler as described `here <https://solidity.readthedocs.io/en/v0.4.24/using-the-compiler.html>`. The output must contain the `abi` and `bytecode` objects from compilation. | ||
``owned_compiler_output.json`` below is expected to be the standard-json output generated by the solidity compiler as described `here <https://solidity.readthedocs.io/en/v0.4.24/using-the-compiler.html>`_. The output must contain the ``abi`` and ``bytecode`` objects from compilation. | ||
|
||
.. doctest:: | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we want to leave this in?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't remove it, I'm just handling it using
html_js_files
instead ofapp.add_js_file
. Both have the same effect, buthtml_js_files
accepts multiple paths so it seemed more efficient.Related documentation:
app.add_js_file
html_js_files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to change it back though if you prefer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, interesting. The new way works for me!