docs: Dark mode screenshots
This commit is contained in:
parent
ea053baf80
commit
7851c5d7d4
|
|
@ -1,5 +1,5 @@
|
|||
updatescreenshots:
|
||||
SCREENSHOT_DIR=screenshots SHOT_WIDTH=1024 SHOT_HEIGHT=680 repo-helper screenshot mainpage-darkop http://localhost:1337/ --width 1024 --height 680 --dark --script resize_viewport.py
|
||||
SCREENSHOT_DIR=screenshots SHOT_WIDTH=1024 SHOT_HEIGHT=680 SHOT_DARK=1 repo-helper screenshot mainpage-darkop http://localhost:1337/ --width 1024 --height 680 --script resize_viewport.py
|
||||
SCREENSHOT_DIR=screenshots SHOT_WIDTH=1024 SHOT_HEIGHT=680 repo-helper screenshot mainpage-laptop http://localhost:1337/ --width 1024 --height 680 --script resize_viewport.py
|
||||
SCREENSHOT_DIR=screenshots SHOT_WIDTH=600 SHOT_HEIGHT=1160 repo-helper screenshot mainpage-phone http://localhost:1337/ --width 600 --height 1160 --script resize_viewport.py
|
||||
repo-common-image-framer
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -6,10 +6,19 @@ from selenium.webdriver.support.ui import WebDriverWait
|
|||
from repo_helper.screenshot import set_viewport_size
|
||||
|
||||
|
||||
def _enable_dark_mode(driver):
|
||||
driver.execute_cdp_cmd(
|
||||
"Emulation.setEmulatedMedia",
|
||||
{"features": [{"name": "prefers-color-scheme", "value": "dark"}]},
|
||||
)
|
||||
|
||||
|
||||
def run(driver):
|
||||
WebDriverWait(driver, 30).until(
|
||||
lambda d: bool(d.find_element(By.TAG_NAME, "body").get_attribute("loaded-dashboard"))
|
||||
)
|
||||
if os.environ.get("SHOT_DARK") == "1":
|
||||
_enable_dark_mode(driver)
|
||||
width = int(os.environ["SHOT_WIDTH"])
|
||||
height = int(os.environ["SHOT_HEIGHT"])
|
||||
set_viewport_size(driver, width, height)
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 66 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 165 KiB After Width: | Height: | Size: 162 KiB |
Loading…
Reference in New Issue