Skip to content

Commit 1247a0d

Browse files
committed
style: add data-color-mode props.
1 parent b074525 commit 1247a0d

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ export interface MarkdownPreviewProps extends Omit<Options, 'children'> {
2222
disableCopy?: boolean;
2323
style?: React.CSSProperties;
2424
pluginsFilter?: (type: 'rehype' | 'remark', plugin: PluggableList) => PluggableList;
25-
warpperElement?: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
25+
warpperElement?: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> & {
26+
'data-color-mode'?: 'light' | 'dark';
27+
};
2628
onScroll?: (e: React.UIEvent<HTMLDivElement>) => void;
2729
onMouseOver?: (e: React.MouseEvent<HTMLDivElement>) => void;
2830
}

src/styles/markdown.less

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@
9898

9999
[data-color-mode*='dark'] .wmde-markdown,
100100
[data-color-mode*='dark'] .wmde-markdown-var,
101+
.wmde-markdown[data-color-mode*='dark'],
101102
body[data-color-mode*='dark'] {
102103
color-scheme: dark;
103104
--color-prettylights-syntax-comment: #8b949e;
@@ -146,6 +147,7 @@ body[data-color-mode*='dark'] {
146147

147148
[data-color-mode*='light'] .wmde-markdown,
148149
[data-color-mode*='light'] .wmde-markdown-var,
150+
.wmde-markdown[data-color-mode*='light'],
149151
body[data-color-mode*='light'] {
150152
color-scheme: light;
151153
--color-prettylights-syntax-comment: #6e7781;

0 commit comments

Comments
 (0)