Skip to content

Commit

Permalink
Merge pull request #8144 from OpenMined/fix/dark-mode
Browse files Browse the repository at this point in the history
fix: dark mode activation
  • Loading branch information
tcp authored Oct 11, 2023
2 parents c1c4875 + f81d714 commit 24740da
Showing 1 changed file with 10 additions and 17 deletions.
27 changes: 10 additions & 17 deletions packages/syft/src/syft/util/notebook_ui/notebook_addons.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,20 @@

CSS_CODE = """
<style>
:root {
--primary-color: #ffffff;
--secondary-color: #f5f5f5;
--tertiary-color: #000000de;
--button-color: #d1d5db;
}
.dark-theme {
body[data-jp-theme-light='false'] {
--primary-color: #111111;
--secondary-color: #212121;
--tertiary-color: #CFCDD6;
--button-color: #111111;
}
}
body {
--primary-color: #ffffff;
--secondary-color: #f5f5f5;
--tertiary-color: #000000de;
--button-color: #d1d5db;
}
.header-1 {
font-style: normal;
font-weight: 600;
Expand Down Expand Up @@ -561,14 +563,6 @@
buildPaginationContainer${uid}(result);
}
function setTheme${uid}(){
const theme = document.body.getAttribute('data-jp-theme-light') === 'true' ? 'light' : 'dark';
if (theme === 'dark') document.body.classList.add('dark-theme');
else document.body.classList.remove('dark-theme');
}
function resetById${uid}(id){
let element = document.getElementById(id);
while (element.firstChild) {
Expand All @@ -583,7 +577,6 @@
let div = document.createElement("div");
div.classList.add('grid-header', 'grid-index-cells');
grid.appendChild(div);
setTheme${uid}();
headers.forEach((title) =>{
let div = document.createElement("div");
div.classList.add('grid-header', 'grid-std-cells');
Expand Down

0 comments on commit 24740da

Please sign in to comment.