Pen Settings

HTML

CSS

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

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

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.

HTML

              
                <link href='' rel='stylesheet'>
<link href='' rel='stylesheet'>


<div class="container" ng-app='colorApp'>
  <div ng-controller='MainCtrl'>
      <div class="header">
        <h3 class="text-muted">Angular Bootstrap Colorpicker</h3>
      </div>

      <div class="jumbotron">
        <h2>angular-bootstrap-colorpicker</h2>
        <p class="lead">
          No jQuery dependendencies, just an AngularJS directive based on the bootstrap-colorpicker jQuery library.
        </p>
        <p>
          <a class="btn btn-lg btn-primary" target="_blank" href="https://github.com/buberdds/angular-bootstrap-colorpicker" role="button">
            View on Github
          </a>
        </p>
      </div>

      <div class="panel panel-default">
        <div class="panel-heading">hex: {{ hexPicker.color }}</div>
        <div class="panel-body">
          <div class="row">
            <div class="col-sm-6">
              <p>
                <button class="btn btn-primary" ng-click="resetColor()">Update Model</button>
              </p>

              <input colorpicker class="form-control" ng-model="hexPicker.color" type="text" />
            </div>

            <div class='col-sm-6'>
              <pre>&lt;input colorpicker ng-model="hexPicker.color" type="text"&gt;</pre>
            </div>
          </div>
        </div>
      </div>
    
      <div class="panel panel-default">
        <div class="panel-heading">rgb: {{ rgbPicker.color }}</div>
        <div class="panel-body">
          <div class='row'>
            <div class='col-sm-6'>
              <p>
                <button class="btn btn-primary" ng-click="resetRBGColor()">Update Model</button>
              </p>
              <input colorpicker="rgb" class="form-control" ng-model="rgbPicker.color" type="text" />
            </div>

            <div class='col-sm-6'>
              <pre>&lt;input colorpicker="rgb" ng-model="rgbPicker.color" type="text"&gt;</pre>
            </div>
          </div>
        </div>
      </div>
    
      <div class="panel panel-default">
        <div class="panel-heading">rgba: {{ rgbaPicker.color }}</div>
        <div class="panel-body">
          <div class='row'>
            <div class='col-sm-6'>
              <p>
                <button class="btn btn-primary" ng-click="resetRBGAColor()">Update Model</button>
              </p>
              <input colorpicker="rgba" colorpicker-position="right" class="form-control" ng-model="rgbaPicker.color"  type="text" />
            </div>

            <div class='col-sm-6'>
              <pre>&lt;input colorpicker="rgba" colorpicker-position="right" ng-model="rgbaPicker.color" type="text"&gt;</pre>
            </div>
          </div>
        </div>
      </div>

      <div class="panel panel-default">
        <div class="panel-heading">non input element model value: {{ nonInput.color }}</div>
        <div class="panel-body">
          <div class='row'>
            <div class="col-sm-6">
              <p>
                <button class="btn btn-primary" ng-click="resetNonInputColor()">Update Model</button>
              </p>
              <button colorpicker type="button" colorpicker-position="top" class="btn btn-success" ng-model="nonInput.color">Change color</button>
            </div>
            <div class='col-sm-6'>
              <pre>&lt;button colorpicker type="button" colorpicker-position="top" ng-model="nonInput.color"&gt;Change Color&lt;/button&gt;</pre>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
              
            
!

CSS

              
                /* Space out content a bit */
body {
  padding-top: 20px;
  padding-bottom: 20px;
}

/* Everything but the jumbotron gets side spacing for mobile first views */
.header,
.marketing,
.footer {
  padding-right: 15px;
  padding-left: 15px;
}

/* Custom page header */
.header {
  border-bottom: 1px solid #e5e5e5;
}
/* Make the masthead heading the same height as the navigation */
.header h3 {
  padding-bottom: 19px;
  margin-top: 0;
  margin-bottom: 0;
  line-height: 40px;
}

/* Custom page footer */
.footer {
  padding-top: 19px;
  color: #777;
  border-top: 1px solid #e5e5e5;
}

/* Customize container */
@media (min-width: 768px) {
  .container {
    max-width: 900px;
  }
}
.container-narrow > hr {
  margin: 30px 0;
}

/* Main marketing message and sign up button */
.jumbotron {
  text-align: center;
  border-bottom: 1px solid #e5e5e5;
}
.jumbotron .btn {
  padding: 14px 24px;
  font-size: 21px;
}

/* Supporting marketing content */
.marketing {
  margin: 40px 0;
}
.marketing p + h4 {
  margin-top: 28px;
}

/* Responsive: Portrait tablets and up */
@media screen and (min-width: 768px) {
  /* Remove the padding we set earlier */
  .header,
  .marketing,
  .footer {
    padding-right: 0;
    padding-left: 0;
  }
  /* Space out the masthead */
  .header {
    margin-bottom: 30px;
  }
  /* Remove the bottom border on the jumbotron for visual effect */
  .jumbotron {
    border-bottom: 0;
  }
}

.nonInput {
  background-color: #f7f7f9;
  border: 1px solid #e1e1e8;
}
              
            
!

JS

              
                'use strict';

angular.module('colorApp', ['colorpicker.module'])

  .controller('MainCtrl', ['$scope', function($scope) {

    $scope.hexPicker = {
      color: ''
    };

    $scope.rgbPicker = {
      color: ''
    };

    $scope.rgbaPicker = {
      color: ''
    };

    $scope.nonInput = {
      color: ''
    };

    $scope.resetColor = function() {
      $scope.hexPicker = {
        color: '#ff0000'
      };
    };

    $scope.resetRBGColor = function() {
      $scope.rgbPicker = {
        color: 'rgb(255,255,255)'
      };
    };

    $scope.resetRBGAColor = function() {
      $scope.rgbaPicker = {
        color: 'rgb(255,255,255, 0.25)'
      };
    };

    $scope.resetNonInputColor = function() {
      $scope.nonInput = {
        color: '#ffffff'
      };
    };

  }]);
              
            
!
999px

Console