You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/README.md
+6-41Lines changed: 6 additions & 41 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,8 +38,6 @@ The `nextjs-themes` library was initially created to achieve a similar functiona
38
38
39
39
- ✅ Manipulate theme via the `useMode` hook
40
40
41
-
- ✅ No cookies when not using the corresponding `ServerTarget`
42
-
43
41
- ✅ Comprehensive documentation with [Typedoc](https://react18-tools.github.io/nextjs-darkmode)
44
42
45
43
Feel free to [request new features](https://github.com/react18-tools/nextjs-darkmode/issues/new?assignees=&labels=&projects=&template=feature_request.md&title=), [discuss](https://github.com/react18-tools/nextjs-darkmode/discussions), or [report bugs](https://github.com/react18-tools/nextjs-darkmode/issues/new?assignees=&labels=&projects=&template=bug_report.md&title=).
@@ -188,7 +164,7 @@ An elegant color switch to toggle color schemes:
188
164
189
165
### HTML & CSS
190
166
191
-
Fully support dark mode, including system preference with `prefers-color-scheme`. The dark/light mode is synced between tabs and modifies the `className` and data-attributes on the `html`or ServerTarget element:
167
+
Fully support dark mode, including system preference with `prefers-color-scheme`. The dark/light mode is synced between tabs and modifies the `className` and data-attributes on the `html`elemnt.
192
168
193
169
```css
194
170
:root {
@@ -206,19 +182,10 @@ Fully support dark mode, including system preference with `prefers-color-scheme`
206
182
[data-rm="dark"] {...}
207
183
```
208
184
209
-
When using `ServerTarget`, use the CSS general sibling combinator (~):
210
-
211
-
```css
212
-
.selector,
213
-
.selector*,
214
-
.selector~*,
215
-
.selector~** {
216
-
--th-variable: value;
217
-
}
218
-
```
219
-
220
185
#### Using the data-attributes
221
186
187
+
data-attributes are very helpful when you want to customize styles in a CSS module file (`styles.module.css`)
188
+
222
189
`data-rm` -> Resolved Mode
223
190
224
191
`data-m` -> User's preference
@@ -352,8 +319,6 @@ Now you can use dark-mode specific classes:
352
319
<h1className="text-black dark:text-white">
353
320
```
354
321
355
-
> When you use Tailwind, make sure you replace `html` in `app/layout` to `<ServerTargettag="html"...`toavoidFOUC.
356
-
357
322
## Performance
358
323
359
324
`nextjs-darkmode` is designed to be fully tree-shakable, including only the code you use. For instance, if you only use the `useMode` hook, the rest of the library's code will be removed during the build process.
0 commit comments