Skip to content

Commit 2f7525f

Browse files
dark/light mode
1 parent 19bdf07 commit 2f7525f

File tree

6 files changed

+24
-1
lines changed

6 files changed

+24
-1
lines changed

components/wysiwyg-editor.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { html, css, LitElement } from "https://cdn.jsdelivr.net/npm/lit@2/+esm";
22

33
class WYSIWYGEditor extends LitElement {
4-
static styles = css`
4+
static styles = css`
55
.editor {
66
border: 1px solid #ccc;
77
padding: 10px;
@@ -22,6 +22,10 @@ class WYSIWYGEditor extends LitElement {
2222
width: 1rem;
2323
height: 1rem;
2424
}
25+
26+
svg{
27+
fill: var(--text-color, --md-sys-color-on-background)
28+
}
2529
`;
2630

2731
static get properties() {

examples/wysiwyg-editor/index.html

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
66
<title>WYSIWYG Editor</title>
77
<script type="module" src="./main.js"></script>
8+
<link rel="stylesheet" href="./style.css">
89
</head>
910
<body>
1011
<wysiwyg-editor-example></wysiwyg-editor-example>

examples/wysiwyg-editor/style.css

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
@import url(theme.light.css) (prefers-color-scheme: light);
2+
@import url(theme.dark.css) (prefers-color-scheme: dark);
3+
4+
5+
:root {
6+
background-color: var(--background-color);
7+
color: var(--text-color);
8+
}

examples/wysiwyg-editor/theme.css

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@import url(theme.dark.css);
2+
@import url(theme.light.css);
+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
:root {
2+
--background-color: rgb(16 20 24);
3+
--text-color: rgb(224 226 232);
4+
}
+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
:root {
2+
--background-color: rgb(248 249 255);
3+
--text-color: rgb(25 28 32);
4+
}

0 commit comments

Comments
 (0)