Merge pull request #22 from aehernandez/dark-mode

Dark mode
This commit is contained in:
Leonardo Cavaletti 2020-12-30 17:14:47 +01:00 committed by GitHub
commit f8f533353a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -100,6 +100,9 @@ name = "Notion Test Site"
# of the generated site, and loconotion will parse all sub-pages present on the page # of the generated site, and loconotion will parse all sub-pages present on the page
page = "https://www.notion.so/Loconotion-Example-Page-03c403f4fdc94cc1b315b9469a8950ef" page = "https://www.notion.so/Loconotion-Example-Page-03c403f4fdc94cc1b315b9469a8950ef"
# optionally apply notion's dark mode, remove the line below to use the default light mode
theme = "dark"
## Global Site Settings ## ## Global Site Settings ##
# this [site] table defines override settings for the whole site # this [site] table defines override settings for the whole site
# later on we will see how to define settings for a single page # later on we will see how to define settings for a single page

View File

@ -261,6 +261,11 @@ class Parser:
) )
return return
# light theme is on by default
# enable dark mode based on https://fruitionsite.com/ dark mode hack
if self.config.get('theme') == 'dark':
self.driver.execute_script("__console.environment.ThemeStore.setState({ mode: 'dark' });")
# scroll at the bottom of the notion-scroller element to load all elements # scroll at the bottom of the notion-scroller element to load all elements
# continue once there are no changes in height after a timeout # continue once there are no changes in height after a timeout
# don't do this if the page has a calendar databse on it or it will load forever # don't do this if the page has a calendar databse on it or it will load forever