Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1052)

Unified Diff: gm/rebaseline_server/static/loader.js

Issue 143273003: rebaseline_server: add bgcolor slider for pixelDiff column (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gm/rebaseline_server/static/view.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/rebaseline_server/static/loader.js
diff --git a/gm/rebaseline_server/static/loader.js b/gm/rebaseline_server/static/loader.js
index 43089c358554920ae7bf8e1fc3fe54900ee7889b..71972d16008e49e93463f91687f651d4f2cd6faf 100644
--- a/gm/rebaseline_server/static/loader.js
+++ b/gm/rebaseline_server/static/loader.js
@@ -619,5 +619,41 @@ Loader.controller(
return d.toString();
}
+ /**
+ * Returns a hex color string (such as "#aabbcc") for the given RGB values.
+ *
+ * @param r (numeric): red channel value, 0-255
+ * @param g (numeric): green channel value, 0-255
+ * @param b (numeric): blue channel value, 0-255
+ */
+ $scope.hexColorString = function(r, g, b) {
+ var rString = r.toString(16);
+ if (r < 16) {
+ rString = "0" + rString;
+ }
+ var gString = g.toString(16);
+ if (g < 16) {
+ gString = "0" + gString;
+ }
+ var bString = b.toString(16);
+ if (b < 16) {
+ bString = "0" + bString;
+ }
+ return '#' + rString + gString + bString;
+ }
+
+ /**
+ * Returns a hex color string (such as "#aabbcc") for the given brightness.
+ *
+ * @param brightnessString (string): 0-255, 0 is completely black
+ *
+ * TODO(epoger): It might be nice to tint the color when it's not completely
+ * black or completely white.
+ */
+ $scope.brightnessStringToHexColor = function(brightnessString) {
+ var v = parseInt(brightnessString);
+ return $scope.hexColorString(v, v, v);
+ }
+
}
);
« no previous file with comments | « no previous file | gm/rebaseline_server/static/view.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698