forked from pandao/editor.md
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththemes.html
207 lines (172 loc) · 6.41 KB
/
themes.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8" />
<title>Themes - Editor.md examples</title>
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="../css/editormd.css" />
<link rel="shortcut icon" href="https://pandao.github.io/editor.md/favicon.ico" type="image/x-icon" />
<style>
/* Custom Editor.md theme css example */
/*
.editormd-theme-dark {
border-color: #1a1a17;
}
.editormd-theme-dark .editormd-toolbar {
background: #1A1A17;
border-color: #1a1a17;
}
.editormd-theme-dark .editormd-menu > li > a {
color: #777;
border-color: #1a1a17;
}
.editormd-theme-dark .editormd-menu > li.divider {
border-right: 1px solid #111;
}
.editormd-theme-dark .editormd-menu > li > a:hover, .editormd-menu > li > a.active {
border-color: #333;
background: #333;
}*/
</style>
</head>
<body>
<div id="layout">
<header>
<h1>Themes</h1>
<p>
<select id="editormd-theme-select">
<option selected="selected" value="">select Editor.md themes</option>
</select>
<select id="editor-area-theme-select">
<option selected="selected" value="">select editor area themes</option>
</select>
<select id="preview-area-theme-select">
<option selected="selected" value="">select preview area themes</option>
</select>
</p>
</header>
<div id="test-editormd">
<textarea style="display:none;">[TOC]
### Themes
#### Setting
configs:
```javascript
{
// Editor.md theme, default or dark, change at v1.5.0
// You can also custom css class .editormd-theme-xxxx
theme : "default | dark",
// Preview container theme, added v1.5.0
// You can also custom css class .editormd-preview-theme-xxxx
previewTheme : "default | dark",
// Added @v1.5.0 & after version this is CodeMirror (editor area) theme
editorTheme : editormd.editorThemes['theme-name']
}
```
functions:
```javascript
editor.setTheme('theme-name');
editor.setEditorTheme('theme-name');
editor.setPreviewTheme('theme-name');
```
#### Default theme
- Editor.md theme : `default`
- Preview area theme : `default`
- Editor area theme : `default`
> Recommend `dark` theme.
#### Recommend editor area themes
- ambiance
- eclipse
- mdn-like
- mbo
- monokai
- neat
- pastel-on-dark
#### Editor area themes
- default
- 3024-day
- 3024-night
- ambiance
- ambiance-mobile
- base16-dark
- base16-light
- blackboard
- cobalt
- eclipse
- elegant
- erlang-dark
- lesser-dark
- mbo
- mdn-like
- midnight
- monokai
- neat
- neo
- night
- paraiso-dark
- paraiso-light
- pastel-on-dark
- rubyblue
- solarized
- the-matrix
- tomorrow-night-eighties
- twilight
- vibrant-ink
- xq-dark
- xq-light
</textarea>
</div>
</div>
<script src="js/jquery.min.js"></script>
<script src="../editormd.js"></script>
<script type="text/javascript">
var testEditor;
function themeSelect(id, themes, lsKey, callback)
{
var select = $("#" + id);
for (var i = 0, len = themes.length; i < len; i ++)
{
var theme = themes[i];
var selected = (localStorage[lsKey] == theme) ? " selected=\"selected\"" : "";
select.append("<option value=\"" + theme + "\"" + selected + ">" + theme + "</option>");
}
select.bind("change", function(){
var theme = $(this).val();
if (theme === "")
{
alert("theme == \"\"");
return false;
}
console.log("lsKey =>", lsKey, theme);
localStorage[lsKey] = theme;
callback(select, theme);
});
return select;
}
$(function() {
testEditor = editormd("test-editormd", {
width : "90%",
height : 720,
// Editor.md theme, default or dark, change at v1.5.0
// You can also custom css class .editormd-preview-theme-xxxx
theme : (localStorage.theme) ? localStorage.theme : "dark",
// Preview container theme, added v1.5.0
// You can also custom css class .editormd-preview-theme-xxxx
previewTheme : (localStorage.previewTheme) ? localStorage.previewTheme : "dark",
// Added @v1.5.0 & after version is CodeMirror (editor area) theme
editorTheme : (localStorage.editorTheme) ? localStorage.editorTheme : "pastel-on-dark",
path : '../lib/'
});
themeSelect("editormd-theme-select", editormd.themes, "theme", function($this, theme) {
testEditor.setTheme(theme);
});
themeSelect("editor-area-theme-select", editormd.editorThemes, "editorTheme", function($this, theme) {
testEditor.setCodeMirrorTheme(theme);
// or testEditor.setEditorTheme(theme);
});
themeSelect("preview-area-theme-select", editormd.previewThemes, "previewTheme", function($this, theme) {
testEditor.setPreviewTheme(theme);
});
});
</script>
</body>
</html>