Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


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


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.


Save Automatically?

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.


Theme should probably be on <body> element but whatever it works too
<article class="wrapper cherry">
  <section class="component">
    <h2 class="component__heading">Sass Color Schemes Demo Page</h2>
    <ul class="component__list">
      <li class="component__list-item"></li>
      <li class="component__list-item"></li>
      <li class="component__list-item"></li>
      <li class="component__list-item"></li>

Buttons to change theme
<section class="controls">
  <button class="controls" data-theme="default">Default</button>
  <button class="controls" data-theme="banana">Funny banana</button>
  <button class="controls" data-theme="cherry" disabled>Hot cherry</button>
  <button class="controls" data-theme="blueberry">Deep purple</button>
  <button class="controls" data-theme="leaf">Smooth leaf</button>
  <button class="controls" data-theme="nightsky">Night sky</button>

<p class="credit">Demo by <a href="">Hugo Giraudel</a>. See <a href="">article</a>.</p>


                // Color themes
$themes: (
  default: #666,
  banana: #f1c40f,
  cherry: #c0392b,
  blueberry: #8e44ad,
  leaf: #27ae60,
  nightsky: #2980b9

// Helper theme mixin
// @param $name: name of the theme (HTML class)
// @param $color: color of the theme
@mixin theme($name, $color) {
  .#{$name} {
      border-color: darken($color, 10%);
    .component__heading {
      color: $color;
    .component__list-item {
      background: lighten($color, 45%);
  [data-theme='#{$name}'] {
    background: $color;
    &:hover {
      background: darken($color, 10%);
    &[disabled] {
      background: desaturate($color, 40%);

// Including themes 
// By looping through the $themes map
@each $key, $value in $themes {
  @include theme($key, $value);

// Default styles
.component {
  background: #EFEFEF;
  padding: 1em;
  margin-bottom: 1em;
  border-top: .5em solid;
  &__heading {
  &__list {
    list-style: none;
    padding: 0;
    overflow: hidden;
  &__list-item {
    float: left;
    width: 24%;
    height: 10em;
    margin-right: 1%;

.controls > button {
  border: none;
  color: white;
  padding: .5em;
  border-radius: .15em;
  font-weight: bold;
  margin-bottom: .5em;

body {
  padding: 1em;

* {
  box-sizing: border-box;

.credit {
  font-size: .8em;
  padding-top: 1.2em;

.credit a {
  color: #444; 


                (function(exports) {
  var themeChanger = {
    settings: {
      wrapper: $('.wrapper'),
      buttons: $('.controls > button')
    init: function () {
      var _self = this;
      this.settings.buttons.on('click', function () {
        var $node = $(this),
            theme = $'theme');
        _self.settings.wrapper.removeClass().addClass('.wrapper ' + theme);
        $node.attr('disabled', true);