Skip to content

Commit

Permalink
Use core generator with specific values
Browse files Browse the repository at this point in the history
  • Loading branch information
skjnldsv committed May 10, 2016
1 parent deb5010 commit f5da6f6
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions js/app/directives/colorpickerDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,17 @@ app.directive('colorpicker', function() {
'#CACBCD'
];
if (typeof String.prototype.toHsl === 'function') {
var hsl = "".toHsl();
listofcolours = [];
for (var colour = 0; colour < 9; colour++) {
var hslcolour = hslToRgb(colour * 40, hsl[1] / 100, hsl[2] / 100);
listofcolours.push(
'#' + parseInt(hslcolour[0], 10).toString(16) +
parseInt(hslcolour[1], 10).toString(16) +
parseInt(hslcolour[2], 10).toString(16)
);
}
var hsl = "";
var hslcolour = "";
// 0 40 80 120 160 200 240 280 320
listofcolours = ["15", "9", "4", "b", "6", "11", "e", "f", "57"];
listofcolours.forEach(function(hash, index) {
hsl = hash.toHsl();
hslcolour = hslToRgb(Math.round(hsl[0]/40)*40, hsl[1]/100, hsl[2]/100);
listofcolours[index] = '#' + parseInt(hslcolour[0], 10).toString(16)+
parseInt(hslcolour[1], 10).toString(16)+
parseInt(hslcolour[2], 10).toString(16)
});
}
return {
scope: {
Expand Down

0 comments on commit f5da6f6

Please sign in to comment.