0.0.11 • Published 9 years ago

color-pick v0.0.11

Weekly downloads
-
License
ISC
Repository
-
Last release
9 years ago

color-pick

Apply the directive to an element. When a user clicks on it, a palette will appear from which a color can be selected.

Instructions

Install locally in your project using npm:

npm install --save color-pick

Include the script in your code:

<script src="node_modules/color-pick/dist/color-pick.js"></script>

Example

  1. Add tm.color-pick as a dependency to your app module:
      angular.module('myApp', ['tm.color-pick'])
  2. Expose your function into the scope of the directive:
    angular.module('myApp')
      .run(function ($rootScope) {
        $rootScope.setBg = function (color) {
          document.body.style.backgroundColor = color;
        };
      });
  3. Add the directive to your html:
    <div ng-app="myApp">
      <input type="button" value="Select a background color" color-pick="setBg(color)">
    </div>
  4. Click on the button, select a color, and watch the background change.
0.0.11

9 years ago

0.0.10

9 years ago

0.0.9

9 years ago

0.0.8

9 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago