Skip to content

Commit 10f92ca

Browse files
committed
Update readme and demo
1 parent db1941e commit 10f92ca

File tree

5 files changed

+42
-10
lines changed

5 files changed

+42
-10
lines changed

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,31 @@ You can add your own CSS rules to the viewer application using `viewer-extra-sty
116116
src="/file.pdf"
117117
viewer-path="/pdfjs-4.0.379-dist"
118118
viewer-extra-styles="#toolbarViewerMiddle { display: none; }"
119-
viewer-extra-styles-urls="['/demo/extra-styles-one.css', '/demo/extra-styles-two.css']">
119+
viewer-extra-styles-urls="['/demo/viewer-custom-theme.css']">
120120
</pdfjs-viewer-element>
121121
```
122+
Build your own theme with viewer's custom variables and `viewer-extra-styles-urls` attribute:
123+
124+
```css
125+
:root {
126+
--main-color: #5755FE;
127+
--toolbar-icon-bg-color: #0200a8;
128+
--field-color: #5755FE;
129+
--separator-color: #5755FE;
130+
--toolbar-border-color: #5755FE;
131+
--field-border-color: #5755FE;
132+
--toolbar-bg-color: rgba(139, 147, 255, .1);
133+
--body-bg-color: rgba(255, 247, 252, .7);
134+
--button-hover-color: rgba(139, 147, 255, .1);
135+
--toolbar-icon-hover-bg-color: #0200a8;
136+
--toggled-btn-color: #0200a8;
137+
--toggled-btn-bg-color: rgba(139, 147, 255, .1);
138+
--toggled-hover-active-btn-color: #5755FE;
139+
--doorhanger-hover-bg-color: rgba(139, 147, 255, .1);
140+
--doorhanger-hover-color: #0200a8;
141+
--dropdown-btn-bg-color: rgba(139, 147, 255, .1);
142+
}
143+
```
122144

123145
## PDF.js Viewer Application
124146

demo/extra-styles-one.css

Lines changed: 0 additions & 4 deletions
This file was deleted.

demo/extra-styles-two.css

Lines changed: 0 additions & 4 deletions
This file was deleted.

demo/extra-styles-urls.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<pdfjs-viewer-element
1818
src="/public/sample-pdf-with-images.pdf"
1919
viewer-path="/public/pdfjs-4.0.379-dist"
20-
viewer-extra-styles-urls="['/demo/extra-styles-one.css', '/demo/extra-styles-two.css']"
20+
viewer-extra-styles-urls="['/demo/viewer-custom-theme.css']"
2121
style="height: 100dvh">
2222
</pdfjs-viewer-element>
2323
</body>

demo/viewer-custom-theme.css

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
:root {
2+
--main-color: #5755FE;
3+
--toolbar-icon-bg-color: #0200a8;
4+
--field-color: #5755FE;
5+
--separator-color: #5755FE;
6+
--toolbar-border-color: #5755FE;
7+
--field-border-color: #5755FE;
8+
--toolbar-bg-color: rgba(139, 147, 255, .1);
9+
--body-bg-color: rgba(255, 247, 252, .7);
10+
--button-hover-color: rgba(139, 147, 255, .1);
11+
--toolbar-icon-hover-bg-color: #0200a8;
12+
--toggled-btn-color: #0200a8;
13+
--toggled-btn-bg-color: rgba(139, 147, 255, .1);
14+
--toggled-hover-active-btn-color: #5755FE;
15+
--doorhanger-hover-bg-color: rgba(139, 147, 255, .1);
16+
--doorhanger-hover-color: #0200a8;
17+
--dropdown-btn-bg-color: rgba(139, 147, 255, .1);
18+
}

0 commit comments

Comments
 (0)