feat: add css parameter for custom CSS injection in screenshots
All checks were successful
Build & Deploy to Staging / Build & Deploy to Staging (push) Successful in 10m33s
All checks were successful
Build & Deploy to Staging / Build & Deploy to Staging (push) Successful in 10m33s
This commit is contained in:
parent
1b7251fbcb
commit
0999474fbd
8 changed files with 176 additions and 17 deletions
|
|
@ -107,17 +107,21 @@ single_hide = snap.capture(
|
|||
)
|
||||
```
|
||||
|
||||
### Combined Dark Mode + Element Hiding
|
||||
### Custom CSS Injection
|
||||
|
||||
```python
|
||||
# Perfect for clean marketing screenshots
|
||||
marketing_shot = snap.capture(
|
||||
"https://your-saas-app.com",
|
||||
# Inject custom CSS before capture
|
||||
styled = snap.capture(
|
||||
"https://example.com",
|
||||
css='body { background: #1a1a2e !important; color: #eee !important }',
|
||||
)
|
||||
|
||||
# Combine with other options
|
||||
combined = snap.capture(
|
||||
"https://example.com",
|
||||
css=".hero { padding: 80px 0 } h1 { font-size: 48px }",
|
||||
dark_mode=True,
|
||||
hide_selectors=[".dev-banner", ".beta-notice"],
|
||||
width=1920,
|
||||
height=1080,
|
||||
device_scale=2,
|
||||
hide_selectors=[".cookie-banner"],
|
||||
)
|
||||
```
|
||||
|
||||
|
|
@ -154,6 +158,7 @@ except SnapAPIError as e:
|
|||
| `wait_until` | `str` | `"domcontentloaded"` | Load event |
|
||||
| `dark_mode` | `bool` | `False` | Emulate prefers-color-scheme: dark |
|
||||
| `hide_selectors` | `list` | — | CSS selectors to hide before capture |
|
||||
| `css` | `str` | — | Custom CSS to inject before capture (max 5000 chars) |
|
||||
|
||||
### `snap.health() -> dict`
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue