Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="wrapper">

  <div class="ui container">
    <h1 class="ui header">Minecraft Chat Preview</h1>
  </div>

  <div id="entry" class="ui container">
    <p class="ui header">Input</p>
    <div class="ui large fluid input">
      <input id="input" name="input" />
    </div>
  </div>

  <div id="render" class="ui container">
    <p class="ui header">Preview</p>
    <div id="preview" class="ui">
      <p id="output" class="fontsforweb_minecraftfont render"></p>
    </div>
  </div>

  <div id="reference" class="ui container">
    <div class="ui stackable grid render">

      <div class="ten wide column">
        <p class="ui header">Colors</p>
        <div id="codes">
          <div class="ui two column stackable grid">

            <div class="column">
              <div class="ui big list">
                <div class="item">&1 <span class="blue">blue</span></div>
                <div class="item">&2 <span class="green">green</span></div>
                <div class="item">&3 <span class="darkaqua">dark aqua</span></div>
                <div class="item">&4 <span class="red">red</span></div>
                <div class="item">&5 <span class="purple">purple</span></div>
                <div class="item">&6 <span class="orange">orange</span></div>
                <div class="item">&7 <span class="gray">gray</span></div>
                <div class="item">&8 <span class="darkgray">dark gray</span></div>
                <div class="item">&0 <span class="black">black</span></div>
              </div>
            </div>

            <div class="column">
              <div class="ui big list">
                <div class="item">&9 <span class="lightblue">light blue</span></div>
                <div class="item">&a <span class="lime">lime green</span></div>
                <div class="item">&b <span class="aqua">aqua</span></div>
                <div class="item">&c <span class="lightred">light red</span></div>
                <div class="item">&d <span class="pink">light purple</span></div>
                <div class="item">&e <span class="yellow">yellow</span></div>
                <div class="item">&f <span class="white">white</span></div>
              </div>
            </div>

          </div>
        </div>
      </div>

      <div class="six wide column">
        <p class="ui header">Formats</p>
        <div id="codes">
          <div class="ui big list">
            <div class="item">&k magic/obfuscated
              <span class="magic"></span>
            </div>
            <div class="item">&l <strong>bold</strong></div>
            <div class="item">&m <s>strikethrough</s></div>
            <div class="item">&n <u>underline</u></div>
            <div class="item">&o <em>italic</em></div>
          </div>
        </div>
      </div>

    </div>
  </div>

  <div class="ui container">
    <p class="right item">
      Background image by <a href="http://ivan2294.deviantart.com/" target="_blank">ivan2294</a> &diam; Pixel font via <a href="http://fontsforweb.com/font/show?id=1412" target="_blank">FontsForWeb</a>
    </p>
  </div>

</div>
<!-- Piwik -->
<script type="text/javascript">
  var _paq = _paq || [];
  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  (function() {
    var u="//mrnrkt.com/panit/";
    _paq.push(['setTrackerUrl', u+'piwik.php']);
    _paq.push(['setSiteId', 5]);
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
    g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
  })();
</script>
<noscript><p><img src="//mrnrkt.com/panit/piwik.php?idsite=5" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->
              
            
!

CSS

              
                body {
  background-image: url('https://sgray.neocities.org/assets/minecraft_tile_background_by_ivan2294.jpg');
}

.wrapper {
  background-color: rgba(110, 110, 110, 0.7);
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  padding-top: 2em;
}

a {
  color: #bdf;
}

a:hover {
  color: #cef;
}

.ui.container {
  margin-bottom: 2em;
}

#input,
#output {
  width: 100%;
}

#preview,
#codes {
  background-color: rgba(10, 10, 10, 0.6);
  border-radius: 3px;
}

#preview {
  color: #fff;
  font-size: 1.6em;
  min-height: 1.6em;
  width: 100%;
  padding: 0.1em 0.5em;
}

#codes {
  color: #ccc;
  padding: 0.9em 1.2em;
}

.render .blue {
  color: #00c;
}

.render .green {
  color: #090;
}

.render .darkaqua {
  color: #0aa;
}

.render .red {
  color: #b00;
}

.render .purple {
  color: #909;
}

.render .orange {
  color: #d60;
}

.render .gray {
  color: #999;
}

.render .darkgray {
  color: #555;
}

.render .lightblue {
  color: #66f;
}

.render .black {
  color: #000;
}

.render .lime {
  color: #0f0;
}

.render .aqua {
  color: #0ff;
}

.render .lightred {
  color: #f55;
}

.render .pink {
  color: #c0f;
}

.render .yellow {
  color: #ff0;
}

.render .white {
  color: #fff;
}
              
            
!

JS

              
                var color = {
  '1': 'blue',
  '2': 'green',
  '3': 'darkaqua',
  '4': 'red',
  '5': 'purple',
  '6': 'orange',
  '7': 'gray',
  '8': 'darkgray',
  '9': 'lightblue',
  '0': 'black',
  'a': 'lime',
  'b': 'aqua',
  'c': 'lightred',
  'd': 'pink',
  'e': 'yellow',
  'f': 'white'
};

var input = $('#input');
var output = $('#output');
var append;

input.keyup(function() {
  render($(this).val());
});

function render(string) {
  append = '';
  output.html(replacers(string));
}

function replacers(string) {
  replaced = string
    .replace(/&([a-f0-9])/gi, setColor)
    .replace(/&k/gi, setMagic)
    .replace(/&l/gi, '<strong>')
    .replace(/&m/gi, '<s>')
    .replace(/&n/gi, '<u>')
    .replace(/&o/gi, '<em>')
    .replace(/&r/gi, resetFormat)
    .replace(/\\n/gi, '<br />');
  return replaced;
}

function setColor(match) {
  var value = color[match.substr(1, match.length)];
  addClose;
  return '<span class="' + value + '">';
}

function setMagic(match) {
  return '<span class="magic"></span>';
}

function getMagic() {
return Math.random().toString(16).substr(1,2).split('.').join("");
}

function runMagic() {
  $('.magic').text(getMagic);
  window.setTimeout(runMagic, 60);
};
runMagic();

function resetFormat(match) {
  addClose;
  return '</strong></s></u></em><span class="white">';
}

function addClose() {
  append = '</span>' + append;
}
              
            
!
999px

Console