topical media & game development

talk show tell print

mobile-query-three-www-vendor-CodeMirror2-demo-theme.htm / htm



  <!doctype html>
  <html>
    <head>
      <title>CodeMirror: Theme Demo</title>
      <link rel="stylesheet" href="../lib/codemirror.css">
      <script src="../lib/codemirror.js"></script>
      <link rel="stylesheet" href="../theme/neat.css">
      <link rel="stylesheet" href="../theme/elegant.css">
      <link rel="stylesheet" href="../theme/night.css">
      <link rel="stylesheet" href="../theme/monokai.css">
      <link rel="stylesheet" href="../theme/cobalt.css">
      <link rel="stylesheet" href="../theme/eclipse.css">
      <link rel="stylesheet" href="../theme/rubyblue.css">
      <script src="../mode/javascript/javascript.js"></script>
      <link rel="stylesheet" href="../doc/docs.css">
  
      <style type="text/css">
        .CodeMirror {border: 1px solid black;}
      </style>
    </head>
    <body>
      <h1>CodeMirror: Theme demo</h1>
  
      <form><textarea id="code" name="code">
  function findSequence(goal) {
    function find(start, history) {
      if (start == goal)
        return history;
      else if (start > goal)
        return null;
      else
        return find(start + 5, "(" + history + " + 5)") ||
               find(start * 3, "(" + history + " * 3)");
    }
    return find(1, "1");
  }</textarea></form>
  
  <p>Select a theme: <select onchange="selectTheme(this)">
      <option selected>default</option>
      <option>night</option>
      <option>monokai</option>
      <option>neat</option>
      <option>elegant</option>
      <option>cobalt</option>
      <option>eclipse</option>
      <option>rubyblue</option>
  </select>
  </p>
  
  <script>
    var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
      lineNumbers: true
    });
    function selectTheme(node) {
      var theme = node.options[node.selectedIndex].innerHTML;
      editor.setOption("theme", theme);
    }
  </script>
    </body>
  </html>
  


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.