Vivek Galatage108 downloadsToggle dark/light appearance for PDF viewers and thumbnails.
Obsidian plugin that toggles a dark/light appearance for PDF viewers and sidebar thumbnails. If PDF++ is installed, rectangular cropped embeds are covered too.
PDF: Light / PDF: Dark label![[file.pdf#page=N&rect=…]], class pdf-cropped-embed) use the same dark/light mode and Darkness / Color / Brightness settings as full PDF viewers. Clicking a crop opens Obsidian’s media lightbox; that popup is inverted only when the image matches a PDF crop (other image lightboxes are left alone). Without PDF++, those embeds are not created, so this feature simply does nothing.Build:
npm install
npm run build
Copy or symlink this folder into:
<vault>/.obsidian/plugins/pdf-toggle-dark-mode/
Required files for Obsidian: main.js, manifest.json, styles.css.
Enable PDF Toggle Dark Mode under Settings → Community plugins.
Open a PDF. On the PDF viewer toolbar you’ll see:
You can also use the ribbon icon, status bar item, or the Toggle PDF dark/light mode command.
Under Settings → PDF Toggle Dark Mode (requires Obsidian 1.13.0+):
| Setting | What it does | Default |
|---|---|---|
| Adapt to theme | PDF dark/light follows Obsidian (and system if Obsidian adapts to system). Manual toggles still work; the next theme change re-syncs. | Off |
| Darkness | How strongly light pages turn dark | 90% |
| Color correction | Makes charts/photos look natural after darkening | 50% (recommended) |
| Brightness | CSS brightness() after darkening (min 20%, max 200%) |
100% |
| Show link outlines | Show/hide the outline boxes around clickable PDF links | On |
Each slider has its own Reset control (toolbar: small rotate icon; Settings: Reset darkness / Reset color correction / Reset brightness). Reset appearance restores all three plus link outlines. Settings are searchable from Obsidian’s global settings search. Toolbar sliders and Settings stay in sync.
npm run dev # watch rebuild
npm run build # production main.js
A repo alone is not enough for the official Community plugins browser.
Obsidian installs plugins by downloading assets from a GitHub Release:
| Asset | Required |
|---|---|
main.js |
yes |
manifest.json |
yes |
styles.css |
yes (this plugin has styles) |
Bump versions so they match (example 1.0.1):
package.json → "version"manifest.json → "version"npm version patch runs version-bump.mjs for manifest.json + versions.jsonCommit and push main.
Trigger a release in either way:
A. Tag push
git tag 1.0.1
git push origin 1.0.1
B. On-demand (Actions UI)
GitHub → Actions → Release Obsidian plugin → Run workflow
manifest.json, or type e.g. 1.0.1 (must match the manifest).The workflow builds the plugin and creates a GitHub Release with main.js, manifest.json, and styles.css (draft unless you opted out on a manual run). Manual runs also create the git tag from the current commit if it does not exist yet.
If it is a draft: GitHub → Releases → review → Publish release.
Only after a published Release can Obsidian (and the community directory, once your plugin is listed) pick up the version.
MIT