| 1 |
<!doctype html> |
| 2 |
|
| 3 |
<title>CodeMirror: Theme Demo</title> |
| 4 |
<meta charset="utf-8"/> |
| 5 |
<link rel=stylesheet href="../doc/docs.css"> |
| 6 |
|
| 7 |
<link rel="stylesheet" href="../lib/codemirror.css"> |
| 8 |
<link rel="stylesheet" href="../theme/3024-day.css"> |
| 9 |
<link rel="stylesheet" href="../theme/3024-night.css"> |
| 10 |
<link rel="stylesheet" href="../theme/abcdef.css"> |
| 11 |
<link rel="stylesheet" href="../theme/ambiance.css"> |
| 12 |
<link rel="stylesheet" href="../theme/base16-dark.css"> |
| 13 |
<link rel="stylesheet" href="../theme/bespin.css"> |
| 14 |
<link rel="stylesheet" href="../theme/base16-light.css"> |
| 15 |
<link rel="stylesheet" href="../theme/blackboard.css"> |
| 16 |
<link rel="stylesheet" href="../theme/cobalt.css"> |
| 17 |
<link rel="stylesheet" href="../theme/colorforth.css"> |
| 18 |
<link rel="stylesheet" href="../theme/dracula.css"> |
| 19 |
<link rel="stylesheet" href="../theme/duotone-dark.css"> |
| 20 |
<link rel="stylesheet" href="../theme/duotone-light.css"> |
| 21 |
<link rel="stylesheet" href="../theme/eclipse.css"> |
| 22 |
<link rel="stylesheet" href="../theme/elegant.css"> |
| 23 |
<link rel="stylesheet" href="../theme/erlang-dark.css"> |
| 24 |
<link rel="stylesheet" href="../theme/gruvbox-dark.css"> |
| 25 |
<link rel="stylesheet" href="../theme/hopscotch.css"> |
| 26 |
<link rel="stylesheet" href="../theme/icecoder.css"> |
| 27 |
<link rel="stylesheet" href="../theme/isotope.css"> |
| 28 |
<link rel="stylesheet" href="../theme/lesser-dark.css"> |
| 29 |
<link rel="stylesheet" href="../theme/liquibyte.css"> |
| 30 |
<link rel="stylesheet" href="../theme/lucario.css"> |
| 31 |
<link rel="stylesheet" href="../theme/material.css"> |
| 32 |
<link rel="stylesheet" href="../theme/mbo.css"> |
| 33 |
<link rel="stylesheet" href="../theme/mdn-like.css"> |
| 34 |
<link rel="stylesheet" href="../theme/midnight.css"> |
| 35 |
<link rel="stylesheet" href="../theme/monokai.css"> |
| 36 |
<link rel="stylesheet" href="../theme/neat.css"> |
| 37 |
<link rel="stylesheet" href="../theme/neo.css"> |
| 38 |
<link rel="stylesheet" href="../theme/night.css"> |
| 39 |
<link rel="stylesheet" href="../theme/nord.css"> |
| 40 |
<link rel="stylesheet" href="../theme/oceanic-next.css"> |
| 41 |
<link rel="stylesheet" href="../theme/panda-syntax.css"> |
| 42 |
<link rel="stylesheet" href="../theme/paraiso-dark.css"> |
| 43 |
<link rel="stylesheet" href="../theme/paraiso-light.css"> |
| 44 |
<link rel="stylesheet" href="../theme/pastel-on-dark.css"> |
| 45 |
<link rel="stylesheet" href="../theme/railscasts.css"> |
| 46 |
<link rel="stylesheet" href="../theme/rubyblue.css"> |
| 47 |
<link rel="stylesheet" href="../theme/seti.css"> |
| 48 |
<link rel="stylesheet" href="../theme/shadowfox.css"> |
| 49 |
<link rel="stylesheet" href="../theme/solarized.css"> |
| 50 |
<link rel="stylesheet" href="../theme/the-matrix.css"> |
| 51 |
<link rel="stylesheet" href="../theme/tomorrow-night-bright.css"> |
| 52 |
<link rel="stylesheet" href="../theme/tomorrow-night-eighties.css"> |
| 53 |
<link rel="stylesheet" href="../theme/ttcn.css"> |
| 54 |
<link rel="stylesheet" href="../theme/twilight.css"> |
| 55 |
<link rel="stylesheet" href="../theme/vibrant-ink.css"> |
| 56 |
<link rel="stylesheet" href="../theme/xq-dark.css"> |
| 57 |
<link rel="stylesheet" href="../theme/xq-light.css"> |
| 58 |
<link rel="stylesheet" href="../theme/yeti.css"> |
| 59 |
<link rel="stylesheet" href="../theme/idea.css"> |
| 60 |
<link rel="stylesheet" href="../theme/darcula.css"> |
| 61 |
<link rel="stylesheet" href="../theme/yonce.css"> |
| 62 |
<link rel="stylesheet" href="../theme/zenburn.css"> |
| 63 |
<script src="../lib/codemirror.js"></script> |
| 64 |
<script src="../mode/javascript/javascript.js"></script> |
| 65 |
<script src="../addon/selection/active-line.js"></script> |
| 66 |
<script src="../addon/edit/matchbrackets.js"></script> |
| 67 |
<style> |
| 68 |
.CodeMirror {border: 1px solid black; font-size:13px} |
| 69 |
</style> |
| 70 |
<div id=nav> |
| 71 |
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a> |
| 72 |
|
| 73 |
<ul> |
| 74 |
<li><a href="../index.html">Home</a> |
| 75 |
<li><a href="../doc/manual.html">Manual</a> |
| 76 |
<li><a href="https://github.com/codemirror/codemirror">Code</a> |
| 77 |
</ul> |
| 78 |
<ul> |
| 79 |
<li><a class=active href="#">Theme</a> |
| 80 |
</ul> |
| 81 |
</div> |
| 82 |
|
| 83 |
<article> |
| 84 |
<h2>Theme Demo</h2> |
| 85 |
<form><textarea id="code" name="code"> |
| 86 |
function findSequence(goal) { |
| 87 |
function find(start, history) { |
| 88 |
if (start == goal) |
| 89 |
return history; |
| 90 |
else if (start > goal) |
| 91 |
return null; |
| 92 |
else |
| 93 |
return find(start + 5, "(" + history + " + 5)") || |
| 94 |
find(start * 3, "(" + history + " * 3)"); |
| 95 |
} |
| 96 |
return find(1, "1"); |
| 97 |
}</textarea></form> |
| 98 |
|
| 99 |
<p>Select a theme: <select onchange="selectTheme()" id=select> |
| 100 |
<option selected>default</option> |
| 101 |
<option>3024-day</option> |
| 102 |
<option>3024-night</option> |
| 103 |
<option>abcdef</option> |
| 104 |
<option>ambiance</option> |
| 105 |
<option>base16-dark</option> |
| 106 |
<option>base16-light</option> |
| 107 |
<option>bespin</option> |
| 108 |
<option>blackboard</option> |
| 109 |
<option>cobalt</option> |
| 110 |
<option>colorforth</option> |
| 111 |
<option>darcula</option> |
| 112 |
<option>dracula</option> |
| 113 |
<option>duotone-dark</option> |
| 114 |
<option>duotone-light</option> |
| 115 |
<option>eclipse</option> |
| 116 |
<option>elegant</option> |
| 117 |
<option>erlang-dark</option> |
| 118 |
<option>gruvbox-dark</option> |
| 119 |
<option>hopscotch</option> |
| 120 |
<option>icecoder</option> |
| 121 |
<option>idea</option> |
| 122 |
<option>isotope</option> |
| 123 |
<option>lesser-dark</option> |
| 124 |
<option>liquibyte</option> |
| 125 |
<option>lucario</option> |
| 126 |
<option>material</option> |
| 127 |
<option>mbo</option> |
| 128 |
<option>mdn-like</option> |
| 129 |
<option>midnight</option> |
| 130 |
<option>monokai</option> |
| 131 |
<option>neat</option> |
| 132 |
<option>neo</option> |
| 133 |
<option>night</option> |
| 134 |
<option>nord</option> |
| 135 |
<option>oceanic-next</option> |
| 136 |
<option>panda-syntax</option> |
| 137 |
<option>paraiso-dark</option> |
| 138 |
<option>paraiso-light</option> |
| 139 |
<option>pastel-on-dark</option> |
| 140 |
<option>railscasts</option> |
| 141 |
<option>rubyblue</option> |
| 142 |
<option>seti</option> |
| 143 |
<option>shadowfox</option> |
| 144 |
<option>solarized dark</option> |
| 145 |
<option>solarized light</option> |
| 146 |
<option>the-matrix</option> |
| 147 |
<option>tomorrow-night-bright</option> |
| 148 |
<option>tomorrow-night-eighties</option> |
| 149 |
<option>ttcn</option> |
| 150 |
<option>twilight</option> |
| 151 |
<option>vibrant-ink</option> |
| 152 |
<option>xq-dark</option> |
| 153 |
<option>xq-light</option> |
| 154 |
<option>yeti</option> |
| 155 |
<option>yonce</option> |
| 156 |
<option>zenburn</option> |
| 157 |
</select> |
| 158 |
</p> |
| 159 |
|
| 160 |
<script> |
| 161 |
var editor = CodeMirror.fromTextArea(document.getElementById("code"), { |
| 162 |
lineNumbers: true, |
| 163 |
styleActiveLine: true, |
| 164 |
matchBrackets: true |
| 165 |
}); |
| 166 |
var input = document.getElementById("select"); |
| 167 |
function selectTheme() { |
| 168 |
var theme = input.options[input.selectedIndex].textContent; |
| 169 |
editor.setOption("theme", theme); |
| 170 |
location.hash = "#" + theme; |
| 171 |
} |
| 172 |
var choice = (location.hash && location.hash.slice(1)) || |
| 173 |
(document.location.search && |
| 174 |
decodeURIComponent(document.location.search.slice(1))); |
| 175 |
if (choice) { |
| 176 |
input.value = choice; |
| 177 |
editor.setOption("theme", choice); |
| 178 |
} |
| 179 |
CodeMirror.on(window, "hashchange", function() { |
| 180 |
var theme = location.hash.slice(1); |
| 181 |
if (theme) { input.value = theme; selectTheme(); } |
| 182 |
}); |
| 183 |
</script> |
| 184 |
</article> |