2Elm.Native.Color.make = function(elm) {
3 elm.Native = elm.Native || {};
4 elm.Native.Color = elm.Native.Color || {};
5 if (elm.Native.Color.values) return elm.Native.Color.values;
7 var Utils = Elm.Native.Utils.make(elm);
11 ? ('rgb(' + c._0 + ', ' + c._1 + ', ' + c._2 + ')')
12 : ('rgba(' + c._0 + ', ' + c._1 + ', ' + c._2 + ', ' + c._3 + ')');
15 function complement(rgb) {
17 hsv.hue = (hsv.hue + 180) % 360;
21 function hsva(h,s,v,a) {
22 var degree = A2(Utils.mod, h * 180 / Math.PI, 360);
23 var clr = toRGB({hue:degree, saturation:s, value:v});
29 var degree = A2(Utils.mod, h * 180 / Math.PI, 360);
30 return toRGB({hue:degree, saturation:s, value:v});
35 var r = rgb._0 / 255.0, g = rgb._1 / 255.0, b = rgb._2 / 255.0;
36 var M = Math.max(r,g,b);
37 var m = Math.min(r,g,b);
41 if (c === 0) { h = 0; }
42 else if (M === r) { h = ((g - b) / c) % 6; }
43 else if (M === g) { h = ((b - r) / c) + 2; }
44 else if (M === b) { h = ((r - g) / c) + 4; }
47 return { value : M, hue : h, saturation : (M === 0 ? 0 : c / M) };
50 function between(lo,hi,x) { return lo <= x && x < hi; }
51 function norm(n) { return Math.round(n*255); }
54 var c = hsv.value * hsv.saturation;
55 var hue = hsv.hue / 60;
56 var x = c * (1 - Math.abs((hue % 2) - 1));
57 var r = 0, g = 0, b = 0;
58 if (between(0,1,hue)) { r = c; g = x; b = 0; }
59 else if (between(1,2,hue)) { r = x; g = c; b = 0; }
60 else if (between(2,3,hue)) { r = 0; g = c; b = x; }
61 else if (between(3,4,hue)) { r = 0; g = x; b = c; }
62 else if (between(4,5,hue)) { r = x; g = 0; b = c; }
63 else if (between(5,6,hue)) { r = c; g = 0; b = x; }
65 var m = hsv.value - c;
66 return { ctor:"Color", _0:norm(r+m), _1:norm(g+m), _2:norm(b+m), _3:1 };
69 return elm.Native.Color.values = {
72 complement:complement,
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list