theme.html 6.5 KB

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