OLD | NEW |
1 /* | 1 /* |
2 * Loader: | 2 * Loader: |
3 * Reads GM result reports written out by results.py, and imports | 3 * Reads GM result reports written out by results.py, and imports |
4 * them into $scope.categories and $scope.testData . | 4 * them into $scope.categories and $scope.testData . |
5 */ | 5 */ |
6 var Loader = angular.module( | 6 var Loader = angular.module( |
7 'Loader', | 7 'Loader', |
8 ['diff_viewer'] | 8 ['diff_viewer'] |
9 ); | 9 ); |
10 | 10 |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 * Returns a human-readable (in local time zone) time string for a | 612 * Returns a human-readable (in local time zone) time string for a |
613 * particular moment in time. | 613 * particular moment in time. |
614 * | 614 * |
615 * @param secondsPastEpoch (numeric): seconds past epoch in UTC | 615 * @param secondsPastEpoch (numeric): seconds past epoch in UTC |
616 */ | 616 */ |
617 $scope.localTimeString = function(secondsPastEpoch) { | 617 $scope.localTimeString = function(secondsPastEpoch) { |
618 var d = new Date(secondsPastEpoch * 1000); | 618 var d = new Date(secondsPastEpoch * 1000); |
619 return d.toString(); | 619 return d.toString(); |
620 } | 620 } |
621 | 621 |
| 622 /** |
| 623 * Returns a hex color string (such as "#aabbcc") for the given RGB values. |
| 624 * |
| 625 * @param r (numeric): red channel value, 0-255 |
| 626 * @param g (numeric): green channel value, 0-255 |
| 627 * @param b (numeric): blue channel value, 0-255 |
| 628 */ |
| 629 $scope.hexColorString = function(r, g, b) { |
| 630 var rString = r.toString(16); |
| 631 if (r < 16) { |
| 632 rString = "0" + rString; |
| 633 } |
| 634 var gString = g.toString(16); |
| 635 if (g < 16) { |
| 636 gString = "0" + gString; |
| 637 } |
| 638 var bString = b.toString(16); |
| 639 if (b < 16) { |
| 640 bString = "0" + bString; |
| 641 } |
| 642 return '#' + rString + gString + bString; |
| 643 } |
| 644 |
| 645 /** |
| 646 * Returns a hex color string (such as "#aabbcc") for the given brightness. |
| 647 * |
| 648 * @param brightnessString (string): 0-255, 0 is completely black |
| 649 * |
| 650 * TODO(epoger): It might be nice to tint the color when it's not completely |
| 651 * black or completely white. |
| 652 */ |
| 653 $scope.brightnessStringToHexColor = function(brightnessString) { |
| 654 var v = parseInt(brightnessString); |
| 655 return $scope.hexColorString(v, v, v); |
| 656 } |
| 657 |
622 } | 658 } |
623 ); | 659 ); |
OLD | NEW |