react-pdf-highlighter-plus 1.1.4 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -123,24 +123,60 @@
123
123
  cursor: crosshair;
124
124
  }
125
125
 
126
- /* Dark mode - softer inversion for comfortable reading
127
- Uses 0.9 intensity by default for a dark gray (~#1a1a1a) instead of pure black.
128
- The brightness adjustment helps maintain readability.
129
- Note: These are fallback values - actual intensity is controlled via inline styles
130
- when darkModeInvertIntensity is customized in the theme prop. */
131
- .PdfHighlighter--dark .page {
132
- filter: invert(0.9) hue-rotate(180deg) brightness(1.05);
133
- }
134
-
135
- /* Double-invert highlights to preserve their original colors */
136
- .PdfHighlighter--dark .PdfHighlighter__highlight-layer {
137
- filter: invert(0.9) hue-rotate(180deg) brightness(0.95);
126
+ /* Dark mode recolors each page at draw time (OKLab map from theme.darkModeColors,
127
+ wired in PdfHighlighter). No CSS invert filter: inverting distorted photos and
128
+ colored text. Highlight/note/config layers render normally — they sit on
129
+ already-recolored pages, so no counter-inversion is needed. */
130
+
131
+ /* Dark mode: give every highlight a persistent red border so they stay legible
132
+ against the recolored dark page (light mode keeps the ring on scrolled-to
133
+ only). :not(--scrolledTo) so the active highlight keeps its stronger double
134
+ ring (equal-specificity rules would otherwise clobber it by load order). */
135
+ .PdfHighlighter--dark
136
+ .TextHighlight:not(.TextHighlight--scrolledTo)
137
+ .TextHighlight__part,
138
+ .PdfHighlighter--dark
139
+ .AreaHighlight:not(.AreaHighlight--scrolledTo)
140
+ .AreaHighlight__part {
141
+ box-shadow: 0 0 0 1px #ff4141;
142
+ }
143
+
144
+ /* The text/highlight layer blends with the page canvas via `multiply`
145
+ (pdf_viewer.css). Over the dark recolored page that crushes highlights to
146
+ near-black, and `screen` washes them out (recolored text is already light, so
147
+ light highlight + light text = no contrast). Instead: normal blend, and make
148
+ the highlight FILLS translucent via --hl-fill-alpha (TextHighlight /
149
+ AreaHighlight read it through color-mix). Translucency comes from the fill
150
+ color, not element opacity, so the red border ring stays crisp. The light text
151
+ then reads on a muted colored tint — a proper dark-mode highlight. */
152
+ .PdfHighlighter--dark {
153
+ --hl-fill-alpha: 42%;
154
+ }
155
+ .PdfHighlighter--dark .textLayer {
156
+ mix-blend-mode: normal;
138
157
  }
139
158
 
140
- .PdfHighlighter--dark .PdfHighlighter__note-layer {
141
- filter: invert(0.9) hue-rotate(180deg) brightness(0.95);
159
+ /* Live text selection: the default opaque blue + multiply/screen makes selected
160
+ text unreadable on dark. Force a translucent selection with normal blend so
161
+ the light text shows through the highlight. */
162
+ .PdfHighlighter--dark .textLayer ::selection {
163
+ background: rgba(120, 162, 247, 0.4) !important;
164
+ mix-blend-mode: normal;
142
165
  }
143
-
144
- .PdfHighlighter--dark .PdfHighlighter__config-layer {
145
- filter: invert(0.9) hue-rotate(180deg) brightness(0.95);
166
+ .PdfHighlighter--dark .MouseSelection {
167
+ mix-blend-mode: normal;
168
+ opacity: 0.4;
169
+ }
170
+
171
+ /* Respect the OS "reduce motion" setting within the viewer (scoped so the
172
+ library doesn't override a consumer's whole app). */
173
+ @media (prefers-reduced-motion: reduce) {
174
+ .PdfHighlighter,
175
+ .PdfHighlighter *,
176
+ .PdfHighlighter *::before,
177
+ .PdfHighlighter *::after {
178
+ animation-duration: 0.01ms !important;
179
+ animation-iteration-count: 1 !important;
180
+ transition-duration: 0.01ms !important;
181
+ }
146
182
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-pdf-highlighter-plus",
3
3
  "type": "module",
4
- "version": "1.1.4",
4
+ "version": "1.2.0",
5
5
  "description": "Set of modern React components for PDF highlighting",
6
6
  "author": "Edward Ha <quocvietha08@gmail.com>",
7
7
  "license": "MIT",