2Elm.Native.Color = function(elm) {
5 elm.Native = elm.Native || {};
6 if (elm.Native.Color) return elm.Native.Color;
9 if (c._3 === 1) { return 'rgb(' + c._0 + ',' + c._1 + ',' + c._2 + ')'; }
10 return 'rgba(' + c._0 + ',' + c._1 + ',' + c._2 + ',' + c._3 + ')';
12 function complement(rgb) {
14 hsv.hue = (hsv.hue + 180) % 360;
18 function hsva(h,s,v,a) {
19 var clr = toRGB({hue:h, saturation:s, value:v});
24 function hsv(h,s,v) { return toRGB({hue:h, saturation:s, value:v}); }
28 var r = rgb._0 / 255.0, g = rgb._1 / 255.0, b = rgb._2 / 255.0;
29 var M = Math.max(r,g,b);
30 var m = Math.min(r,g,b);
34 if (c === 0) { h = 0; }
35 else if (M === r) { h = ((g - b) / c) % 6; }
36 else if (M === g) { h = ((b - r) / c) + 2; }
37 else if (M === b) { h = ((r - g) / c) + 4; }
40 return { value : M, hue : h, saturation : (M === 0 ? 0 : c / M) };
43 function between(lo,hi,x) { return lo <= x && x < hi; }
44 function norm(n) { return Math.round(n*255); }
47 var c = hsv.value * hsv.saturation;
48 var hue = hsv.hue / 60;
49 var x = c * (1 - Math.abs((hue % 2) - 1));
50 var r = 0, g = 0, b = 0;
51 if (between(0,1,hue)) { r = c; g = x; b = 0; }
52 else if (between(1,2,hue)) { r = x; g = c; b = 0; }
53 else if (between(2,3,hue)) { r = 0; g = c; b = x; }
54 else if (between(3,4,hue)) { r = 0; g = x; b = c; }
55 else if (between(4,5,hue)) { r = x; g = 0; b = c; }
56 else if (between(5,6,hue)) { r = c; g = 0; b = x; }
58 var m = hsv.value - c;
59 return { ctor:"Color", _0:norm(r+m), _1:norm(g+m), _2:norm(b+m), _3:1 };
62 return elm.Native.Color = {
65 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