Giter Site home page Giter Site logo

ng2-color-picker-4th's Introduction

ng2-color-picker-4th

Simple color picker for Angular 2 with ng-bootstrap dependency

Screenshot open

Dependencies

The module relies on ng-bootstrap for dropdown functionality. (https://ng-bootstrap.github.io)

Installation

To include in your project install via NPM with:

npm install --save ng2-color-picker-4th

You will then need to include the module to your app.module.ts:

import { ColorPickerModule } from 'ng2-color-picker-4th';

// ...

@NgModule({
    imports: [
        ColorPickerModule
    ]
})
///...

Finally, include the component in your HTML as per the next section.

HTML Component Markup

Once the module is installed, you will need to add HTML markup to include the picker in a component. The minimum requirement is an [(ngModel)] attribute, which should provide a string representation of a color.

<color-picker
    [(ngModel)]="color">
</color-picker>

It is possible to configure ng2-color-picker by providing a configuration object to the [pickerConfig] attribute (see the next section for more details on this object):

<color-picker
    [(ngModel)]="color"
    [pickerConfig]="pickerOptions">
</color-picker>

Configuration

ng2-color-picker exposes an interface to provide an indication of valid configuration properties, this can be referenced as a type for your configuration object by importing it:

import { IPickerConfiguration } from 'ng2-color-picker-4th';

Which can then be used as the configuration object type in your component:

public pickerOptions: IPickerConfiguration;

Current list of configuration options, types and default values:

Property Type Default Description.
width number 25 Width of the picker control.
height number 25 Height of the picker control.
borderRadius number 4 Radius of the picker control border.
availableColors string[] ['#f00', '#0f0', '#00f'] Default list of colors available from the dropdown menu.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.