Skip to content

Commit 0029890

Browse files
committed
Add colorScheme information to README
1 parent 7926880 commit 0029890

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ diff2htmlUi.draw();
201201

202202
```html
203203
<!-- Stylesheet -->
204-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/styles/github.min.css" />
204+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/styles/github.min.css" />
205205
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/diff2html/bundles/css/diff2html.min.css" />
206206

207207
<!-- Javascripts -->
@@ -227,6 +227,21 @@ document.addEventListener('DOMContentLoaded', () => {
227227
});
228228
```
229229

230+
When using the `auto` color scheme, you will need to specify both the light and dark themes for highlight.js to use.
231+
232+
```html
233+
<link
234+
rel="stylesheet"
235+
href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/styles/github.min.css"
236+
media="screen and (prefers-color-scheme: light)"
237+
/>
238+
<link
239+
rel="stylesheet"
240+
href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/styles/github-dark.min.css"
241+
media="screen and (prefers-color-scheme: dark)"
242+
/>
243+
```
244+
230245
#### Collapsable File Summary List
231246

232247
> Add the dependencies.
@@ -386,6 +401,8 @@ The HTML output accepts a Javascript object with configuration. Possible options
386401
> [src/templates](https://github.com/rtfpessoa/diff2html/tree/master/src/templates)
387402
- `highlightLanguages`: Map of extension to language name, used for highlighting. This overrides the default language
388403
detection based on file extensions.
404+
- `colorScheme`: color scheme to use for the diff, default is `light`. Possible values are `light`, `dark`, and `auto`
405+
which will use the browser's preferred color scheme.
389406

390407
### Diff2Html Browser
391408

0 commit comments

Comments
 (0)