npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ng-chroma

v0.0.8

Published

Most beautiful spectrum color picker for angular 1.5+

Downloads

13

Readme

ng-chroma

Description

ng-chroma is component for choosing colors using HSB spectrum, dedicated for Angular 1.5+. Library was created with simplicity of customization and configuration in mind.

Its features includes:

  • CMYK selector
  • Alpha channel selector
  • Displaying list of user-defined colors

7

1. Installing via npm

npm install ng-chroma

2. Importing ng-chroma to your project

Using UMD (webpack etc.)

var ngChromaModule = require('ng-chroma');
angular.module('yourModule', [ngChromaModule]);

Using ES6 modules

import ngChromaModule from 'ng-chroma';
angular.module('yourModule', [ngChromaModule]);

Import CSS styles from node_modules

import 'ng-chroma/dist/ng-chroma.css';

If you're using webpack, css-loader or similar must be configured. If you want to utilize style sources (or write your own), please refer to src/ng-chroma.styles.less file.

3. Usage

3.1 Simple usage

Just include component in your HTML and provide ng-model:

<ng-chroma ng-model="myModel"></ng-chroma>

It will render control, hook all event listeners and reflect any change to model in a two-way manner.

Preview:

1

3.2 With user provided predefined colors

// controller.js
$scope.myColors = ['#ff0000', '#0000ff'];
<!-- view.html -->
<ng-chroma ng-model="myModel" custom-colors="myColors"></ng-chroma>

Preview:

2

3.3 With user provided predefined colors and label

<!-- view.html -->
<ng-chroma ng-model="myModel" custom-colors="myColors" custom-colors-label="Saved colors:"></ng-chroma>

Preview:

3

3.4 With selected value indicator

<!-- view.html -->
<ng-chroma ng-model="myModel" show-selected-value></ng-chroma>

Preview:

4

3.5 With CMYK controls

<!-- view.html -->
<ng-chroma ng-model="myModel" cmyk-colors></ng-chroma>

Preview:

5

3.6 With alpha channel

<!-- view.html -->
<ng-chroma ng-model="myModel" alpha-colors></ng-chroma>

Preview:

6

4. Customizing component

All styles can be easily overriden, using following pattern:

<!-- view.html -->
<div class="myContainer">
  <ng-chroma ng-model="myModel" alpha-colors></ng-chroma>
</div>
/* style-override.css */
.myContainer ng-chroma .<element-class> { /* ... */ }

Below is shortened list of sub-component classes that you can customize:

  • .color-picker-selector - Main popup element
  • .margin - Margin between segments
  • .separator - Separator between predefined colors and spectrum selector
  • .main-button, .main-button-preview, .main-caret - Main button invoking popup and its elements
  • .user-color, .user-color-container, .user-color-preview, .user-color-label - Buttons with predefined colors and their components
  • .picker-cmyk, .picker-cmyk-input - Margin between segments
  • .hsl-selector-saturation - Main spectrum saturation container
  • .hsl-selector-saturation-handle - Main spectrum saturation handle
  • .hsl-selector-hue - Main spectrum hue container
  • .hsl-selector-hue-handle - Main spectrum hue handle
  • .alpha-selector - Alpha channel selector

5. Contributing

Feel free to fork, hack, crack and change everything :). Don't hestitate to contact me to be added as contributor.

6. Development

ng-chroma goes with webpack build files with commands defined in package.json.

In order to run build script, run: npm run build

In order to run watchers on webpack-dev-server with HTML testbed files served, run: npm run watch

6. License

WTFPL