Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

org.webjars.bower:md-color-picker

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

org.webjars.bower:md-color-picker

WebJar for md-color-picker

  • 1.0.0-pre-alpha.3
  • Source
  • Maven
  • Socket score

Version published
Maintainers
1
Source

IGNORE THIS README IF YOU ARE VIEWING THE plugin-rewrite BRANCH

md-color-picker

Angular-Material based color picker with no jQuery or other DOM/utility library dependencies.

NPM version BOWER version Build Status

preview

Demo

Try out the demo here: GitHub Page

Install

NPM
  1. Download tinycolor.js 1.2.1 or higher. Other versions may work, though 1.2.1 was used to develop this.
  2. Install md-color-picker.
npm install md-color-picker
Bower (includes tinycolor.js):
bower install md-color-picker

Angular dependencies

Other dependencies

The only other dependency is tinycolor.js which is an exceptional color manipulation library.

Usage

  • Include the css.
<link href="path/to/md-color-picker/dist/mdColorPicker.min.css" rel="stylesheet" />
  • Include the javascript.
<script src="path/to/tinycolor/dist/tinycolor-min.js"></script>
<script src="path/to/md-color-picker/dist/mdColorPicker.min.js"></script>
  • Add dependencies to your application (ngCookies is optional)
var app = angular.module('myApp', ['ngMaterial','ngCookies', 'mdColorPicker']);
  • Place the directive wherever it is needed. note: this breaks the old version 0.1 as it now uses ng-model instead of value
<div md-color-picker ng-model="valueObj"></div>

Options

Options may be set either by an options object on the md-color-picker attribute and/or using attributes. If an option is present on both the options object and as an attribute, the attribute will take precedence.

Setting options by scope object

// Controller
$scope.scopeVariable.options = {
    label: "Choose a color",
    icon: "brush",
    default: "#f00",
    genericPalette: false,
    history: false
};
<div md-color-picker="scopeVariable.options" ng-model="scopeVariable.color"></div>

Setting options by attribute

<div
    md-color-picker
    ng-model="scopeVariable.color"
    label="Choose a color"
    icon="brush"
    default="#f00"
    md-color-generic-palette="false"
    md-color-history="false"
></div>
Option Object nameAttribute Option nameTypeDefaultDescription
typetypeInt0Default output type. 0: hex, 1: rgb, 2: hsl
labellabelString""The lable for the input.
iconiconString""Material Icon name. https://design.google.com/icons/
randomrandomBooleanfalseSelect a random color on open
defaultdefaultColor"rgb(255,255,255)"Default color
openOnInputopen-on-inputBooleantrueOpen color picker when user clicks on the input field. If disabled, color picker will only open when clicking on the preview.
hasBackdrophas-backdropBooleantrueDialog Backdrop. https://material.angularjs.org/latest/api/service/$mdDialog
clickOutsideToCloseclick-outside-to-closeBooleantrueDialog click outside to close. https://material.angularjs.org/latest/api/service/$mdDialog
skipHideskip-hideBooleantrueAllows for opening multiple dialogs. https://github.com/angular/material/issues/7262
preserveScopepreserve-scopeBooleantrueDialog preserveScope. https://material.angularjs.org/latest/api/service/$mdDialog
clearButtonmd-color-clear-buttonBooleantrueShow the "clear" button inside of the input.
previewmd-color-previewBooleantrueShow the color preview circle next to the input.
alphaChannelmd-color-alpha-channelBooleantrueEnable alpha channel.
spectrummd-color-spectrumBooleantrueShow the spectrum tab.
slidersmd-color-slidersBooleantrueShow the sliders tab.
genericPalettemd-color-generic-paletteBooleantrueShow the generic palette tab.
materialPalettemd-color-material-paletteBooleantrueShow the material colors palette tab.
historymd-color-historyBooleantrueShow the history tab.
hexmd-color-hexBooleantrueShow the HEX values tab.
rgbmd-color-rgbBooleantrueShow the RGB values tab.
hslmd-color-hslBooleantrueShow the HSL values tab.
defaultTabmd-color-default-tabString, Int"spectrum"Which tab should be selected when opening. Can either be a string or index. If the value is an index, do not count hidden/disabled tabs.
  • spectrum
  • sliders
  • genericPalette
  • materialPalette
  • history

Disclaimer

This is still in a very early beta, and is rapidly changing (3 versions before initial commit). I am open to any and all help anyone is willing to put in. Will update as we go.

Known issues / TODO

[ ] Break apart md-color-picker into other directives, md-color-picker-preview , input, etc. [ ] Add i18n support. [ ] Refactor LESS [ ] Add optional SASS file [ ] IE 11 Issues [ ] Inline dropdown mode [ ] Validation

FAQs

Package last updated on 08 Feb 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc