0.0.11 • Published 10 years ago

color-pick v0.0.11

Weekly downloads
-
License
ISC
Repository
-
Last release
10 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

10 years ago

0.0.10

10 years ago

0.0.9

10 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago