-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
69 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Class naming | ||
|
||
The class by default for deciding the color mode is inserted in the HTML tag. `${color}-mode` | ||
|
||
e.g. | ||
|
||
```html | ||
<!DOCTYPE html> | ||
<html lang="en" class="light-mode"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
... | ||
``` | ||
|
||
## Custom | ||
|
||
You can also customize the class name. | ||
|
||
| prop | Type | default | ||
| -------------- | --------- | ---------------------------------------------------- | ||
| `className` | String | `%cm-mode` | ||
|
||
::: tip | ||
**`%cm`**: We use this placeholder to color mode that will be implemented | ||
::: | ||
|
||
**e.g.** | ||
|
||
```vue | ||
<VueDarkMode className="%cm-theme"> | ||
<template v-slot="{ mode }"> | ||
Color mode: {{ mode }} | ||
</template> | ||
</VueDarkMode> | ||
``` | ||
|
||
**Output:** | ||
|
||
```html | ||
<!DOCTYPE html> | ||
<html lang="en" class="light-theme"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
... | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,23 @@ | ||
# TailwindCSS Dark Mode | ||
|
||
By default, [tailwindcss-dark-mode](https://github.com/ChanceArthur/tailwindcss-dark-mode) uses the `.mode-dark` selector for dark mode. | ||
You can see more in the documentation section: [Changing the Selector](https://github.com/ChanceArthur/tailwindcss-dark-mode#changing-the-selector). | ||
|
||
The example below shows how you can modify the plugin selector to correctly serve the dark class generated by @vue-a11y/dark-mode. | ||
It is possible to [changing the Selector](https://github.com/ChanceArthur/tailwindcss-dark-mode#changing-the-selector) in "tailwindcss-dark-mode" plug-in, however, you can also adjust the class using the [className](/guide/class-naming.html) prop to generate the class compatible with the plugin. | ||
|
||
```javascript | ||
// tailwind.config.js | ||
module.exports = { | ||
theme: { | ||
darkSelector: '.dark-mode' | ||
}, | ||
plugins: [ | ||
require('tailwindcss-dark-mode')() | ||
] | ||
... | ||
} | ||
``` | ||
e.g. | ||
|
||
```vue | ||
<VueDarkMode className="mode-%cm"> | ||
<template v-slot="{ mode }"> | ||
Color mode: {{ mode }} | ||
</template> | ||
</VueDarkMode> | ||
``` | ||
|
||
```html | ||
<!DOCTYPE html> | ||
<html lang="en" class="mode-dark"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
... | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters