|
8 | 8 | </head>
|
9 | 9 | <style>
|
10 | 10 | :root {
|
11 |
| - --font-color: #333; |
12 |
| - --bg-color: #fff; |
| 11 | + --font-color: #323E48; |
| 12 | + --bg-color: #dbe6ee; |
| 13 | + --bfont-color: #318B6F; |
| 14 | + --dbg-color: rgba(0, 0, 0, 0.1); |
13 | 15 | }
|
14 | 16 |
|
15 | 17 | [data-theme="dark"] {
|
16 |
| - --font-color: #fff; |
17 |
| - --bg-color: #161625; |
| 18 | + --font-color: #B3C8D8; |
| 19 | + --bg-color: #323E48; |
| 20 | + --bfont-color: #9ADECE; |
18 | 21 | }
|
19 | 22 |
|
20 | 23 | * {
|
21 | 24 | box-sizing: border-box;
|
22 | 25 | outline: 0;
|
23 | 26 | border: 0;
|
24 |
| - font-family: 'Nunito', 'Roboto', 'Noto', sans-serif; |
| 27 | + } |
| 28 | + |
| 29 | + ::-webkit-scrollbar { |
| 30 | + background-color: var(--dbg-color); |
| 31 | + width: 8px; |
| 32 | + height: 8px; |
| 33 | + } |
| 34 | + |
| 35 | + ::-webkit-scrollbar-thumb:window-inactive, |
| 36 | + ::-webkit-scrollbar-thumb { |
| 37 | + background: var(--dbg-color); |
| 38 | + } |
| 39 | + |
| 40 | + ::-webkit-scrollbar-thumb:hover { |
| 41 | + background: rgba(0, 0, 0, 0.2); |
| 42 | + } |
| 43 | + |
| 44 | + ::-webkit-scrollbar-thumb:active { |
| 45 | + background: rgba(0, 0, 0, 0.3); |
| 46 | + } |
| 47 | + |
| 48 | + ::placeholder { |
| 49 | + color: var(--font-color); |
| 50 | + } |
| 51 | + |
| 52 | + @keyframes fadein { |
| 53 | + from { |
| 54 | + opacity: 0; |
| 55 | + } |
| 56 | + |
| 57 | + to { |
| 58 | + opacity: 1; |
| 59 | + } |
| 60 | + } |
| 61 | + |
| 62 | + a { |
| 63 | + color: var(--bfont-color); |
25 | 64 | }
|
26 | 65 |
|
27 | 66 | body {
|
|
34 | 73 | color: var(--font-color);
|
35 | 74 | width: 100%;
|
36 | 75 | height: 100vh;
|
| 76 | + font-size: 16px; |
| 77 | + font-family: "SF Mono", "Lucida Console", Monaco, monospace; |
| 78 | + line-height: 1.5; |
| 79 | + animation: fadein .2s; |
37 | 80 | }
|
38 | 81 |
|
39 | 82 | .theme-switch {
|
40 | 83 | display: inline-block;
|
41 |
| - height: 32px; |
| 84 | + height: 16px; |
42 | 85 | position: relative;
|
43 |
| - width: 60px; |
| 86 | + width: 32px; |
44 | 87 | }
|
45 | 88 |
|
46 | 89 | .theme-switch input {
|
47 | 90 | display: none;
|
48 | 91 | }
|
49 | 92 |
|
50 | 93 | .slider {
|
51 |
| - background-color: #ccc; |
| 94 | + background-color: var(--dbg-color); |
52 | 95 | bottom: 0;
|
53 | 96 | cursor: pointer;
|
54 | 97 | left: 0;
|
|
59 | 102 | }
|
60 | 103 |
|
61 | 104 | .slider:before {
|
62 |
| - background-color: #fff; |
63 |
| - bottom: 4px; |
| 105 | + background-color: var(--dbg-color); |
| 106 | + bottom: 0px; |
64 | 107 | content: "";
|
65 |
| - height: 24px; |
66 |
| - left: 4px; |
| 108 | + height: 16px; |
| 109 | + left: 0px; |
67 | 110 | position: absolute;
|
68 | 111 | transition: .2s;
|
69 |
| - width: 24px; |
| 112 | + width: 16px; |
70 | 113 | }
|
71 | 114 |
|
72 | 115 | input:checked+.slider {
|
73 | 116 | background-color: #58DE71;
|
74 | 117 | }
|
75 | 118 |
|
76 | 119 | input:checked+.slider:before {
|
77 |
| - transform: translateX(28px); |
| 120 | + transform: translateX(16px); |
78 | 121 | }
|
79 | 122 |
|
80 | 123 | .slider.round {
|
81 |
| - border-radius: 32px; |
| 124 | + border-radius: 16px; |
82 | 125 | }
|
83 | 126 |
|
84 | 127 | .slider.round:before {
|
|
87 | 130 |
|
88 | 131 | .container {
|
89 | 132 | display: flex;
|
90 |
| - background-color: #000; |
91 | 133 | width: 100%;
|
92 | 134 | height: 100%;
|
93 | 135 | flex-direction: column;
|
94 | 136 | }
|
95 | 137 |
|
96 | 138 | .header {
|
97 |
| - background-color: #fff; |
| 139 | + display: flex; |
| 140 | + align-items: center; |
| 141 | + justify-content: space-between; |
| 142 | + padding: 16px; |
| 143 | + background-color: var(--dbg-color); |
98 | 144 | }
|
99 | 145 |
|
100 | 146 | .content {
|
|
103 | 149 | overflow: hidden;
|
104 | 150 | }
|
105 | 151 |
|
106 |
| - .markdown { |
107 |
| - display: inline-flex; |
108 |
| - flex-grow: 1; |
109 |
| - background-color: #222; |
110 |
| - flex-direction: column; |
111 |
| - overflow: auto; |
112 |
| - } |
113 |
| - |
114 | 152 | textarea {
|
115 | 153 | width: 50vw;
|
116 | 154 | height: 100%;
|
117 | 155 | resize: none;
|
118 | 156 | display: flex;
|
119 | 157 | flex-grow: 1;
|
120 |
| - background-color: #777; |
| 158 | + background-color: var(--bg-color); |
| 159 | + color: var(--font-color); |
| 160 | + padding: 16px; |
| 161 | + line-height: 2; |
| 162 | + font-size: 14px; |
| 163 | + } |
| 164 | + |
| 165 | + .markdown { |
| 166 | + display: flex; |
| 167 | + flex-grow: 1; |
| 168 | + flex-direction: column; |
| 169 | + overflow: auto; |
| 170 | + padding: 16px; |
| 171 | + font-family: 'Nunito', 'Roboto', 'Noto', sans-serif; |
121 | 172 | }
|
122 | 173 |
|
123 | 174 | </style>
|
|
126 | 177 | <div class="container">
|
127 | 178 | <div class="header">
|
128 | 179 | <span>markdown</span>
|
| 180 | + <label class="theme-switch" for="checkbox"> |
| 181 | + <input type="checkbox" id="checkbox"> |
| 182 | + <div class="slider round"></div> |
| 183 | + </label> |
129 | 184 | </div>
|
130 | 185 | <div class="content">
|
131 | 186 | <div class="editor">
|
132 |
| - <textarea name="" id="getm"></textarea> |
| 187 | + <textarea name="" id="getm" placeholder="paste markdown here" oninput="keyup()"></textarea> |
133 | 188 | </div>
|
134 | 189 | <div class="markdown" id="content">
|
135 | 190 | </div>
|
|
146 | 201 | }
|
147 | 202 | }
|
148 | 203 | toggleSwitch.addEventListener('change', switchTheme, false);
|
149 |
| - window.onkeyup = keyup; |
150 | 204 |
|
151 |
| - function keyup(e) { |
| 205 | + function keyup() { |
152 | 206 | var mark = document.getElementById('getm').value;
|
153 |
| - document.getElementById('content').innerHTML = marked(mark); |
| 207 | + if (mark) |
| 208 | + document.getElementById('content').innerHTML = marked(mark); |
| 209 | + else |
| 210 | + document.getElementById('content').innerHTML = "marcdown will appere here"; |
154 | 211 | }
|
155 | 212 |
|
156 | 213 | </script>
|
|
0 commit comments