mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-02 16:29:47 +02:00
refactor: recommend using data-theme without html element selector (#6668)
* refactor: recommend using data-theme without html element selector * simplify site CSS * refactor
This commit is contained in:
parent
4b7bea950f
commit
b89d93fab5
18 changed files with 88 additions and 64 deletions
|
@ -120,11 +120,11 @@ import DocusaurusSvg from './docusaurus.svg';
|
|||
```
|
||||
|
||||
```css
|
||||
html[data-theme='light'] .themedDocusaurus [fill='#FFFF50'] {
|
||||
[data-theme='light'] .themedDocusaurus [fill='#FFFF50'] {
|
||||
fill: greenyellow;
|
||||
}
|
||||
|
||||
html[data-theme='dark'] .themedDocusaurus [fill='#FFFF50'] {
|
||||
[data-theme='dark'] .themedDocusaurus [fill='#FFFF50'] {
|
||||
fill: seagreen;
|
||||
}
|
||||
```
|
||||
|
@ -173,8 +173,8 @@ GitHub uses its own [image theming approach](https://github.blog/changelog/2021-
|
|||
To toggle the visibility of an image using the path fragment (for GitHub, it's `#gh-dark-mode-only` and `#gh-light-mode-only`), add the following to your custom CSS (you can also use your own suffix if you don't want to be coupled to GitHub):
|
||||
|
||||
```css title="src/css/custom.css"
|
||||
html[data-theme='light'] img[src$='#gh-dark-mode-only'],
|
||||
html[data-theme='dark'] img[src$='#gh-light-mode-only'] {
|
||||
[data-theme='light'] img[src$='#gh-dark-mode-only'],
|
||||
[data-theme='dark'] img[src$='#gh-light-mode-only'] {
|
||||
display: none;
|
||||
}
|
||||
```
|
||||
|
|
|
@ -197,7 +197,7 @@ To accomplish this, Docusaurus adds the `docusaurus-highlight-code-line` class t
|
|||
}
|
||||
|
||||
/* If you have a different syntax highlighting theme for dark mode. */
|
||||
html[data-theme='dark'] .docusaurus-highlight-code-line {
|
||||
[data-theme='dark'] .docusaurus-highlight-code-line {
|
||||
/* Color which works with dark mode syntax highlighting theme */
|
||||
background-color: rgb(100, 100, 100);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue