Skip to content

Commit

Permalink
pythongh-121035: Improve logging flow diagram for dark/light modes. (p…
Browse files Browse the repository at this point in the history
  • Loading branch information
vsajip authored and estyxx committed Jul 17, 2024
1 parent fc58e8b commit aa70c04
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 11 deletions.
38 changes: 38 additions & 0 deletions Doc/howto/logging.rst
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,44 @@ following diagram.
.. raw:: html
:file: logging_flow.svg

.. raw:: html

<script>
/*
* This snippet is needed to handle the case where a light or dark theme is
* chosen via the theme is selected in the page. We call the existing handler
* and then add a dark-theme class to the body when the dark theme is selected.
* The SVG styling (above) then does the rest.
*
* If the pydoc theme is updated to set the dark-theme class, this snippet
* won't be needed any more.
*/
(function() {
var oldActivateTheme = activateTheme;
function updateBody(theme) {
let elem = document.body;
if (theme === 'dark') {
elem.classList.add('dark-theme');
}
else {
elem.classList.remove('dark-theme');
}
}
activateTheme = function(theme) {
oldActivateTheme(theme);
updateBody(theme);
};
/*
* If the page is refreshed, make sure we update the body - the overriding
* of activateTheme won't have taken effect yet.
*/
updateBody(localStorage.getItem('currentTheme') || 'auto');
})();
</script>

Loggers
^^^^^^^

Expand Down
35 changes: 24 additions & 11 deletions Doc/howto/logging_flow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit aa70c04

Please sign in to comment.