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

Unified Diff: tracing/tracing/base/color.html

Issue 1429863004: Actually fix analysis link hovering (Closed) Base URL: https://github.com/catapult-project/catapult.git@master
Patch Set: Created 5 years, 2 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 | tracing/tracing/base/color_scheme.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tracing/tracing/base/color.html
diff --git a/tracing/tracing/base/color.html b/tracing/tracing/base/color.html
index d779b83fda276bb4bb926073f95fd7afdbb64c22..586706b69779d40ec484af84ecd276871a2371ab 100644
--- a/tracing/tracing/base/color.html
+++ b/tracing/tracing/base/color.html
@@ -9,6 +9,9 @@ found in the LICENSE file.
'use strict';
tr.exportTo('tr.b', function() {
+ function clamp01(value) {
+ return Math.max(0, Math.min(1, value));
+ }
function Color(opt_r, opt_g, opt_b, opt_a) {
this.r = Math.floor(opt_r) || 0;
@@ -150,7 +153,7 @@ tr.exportTo('tr.b', function() {
lighten: function(k, opt_max_l) {
var max_l = opt_max_l !== undefined ? opt_max_l : 1.0;
var hsl = this.toHSL();
- hsl.l = Math.max(0, Math.min(max_l, hsl.l + k));
+ hsl.l = clamp01(hsl.l + k);
return Color.fromHSL(hsl);
},
@@ -168,9 +171,15 @@ tr.exportTo('tr.b', function() {
this.a);
},
- desaturate: function() {
+ desaturate: function(opt_desaturateFactor) {
+ var desaturateFactor;
+ if (opt_desaturateFactor !== undefined)
+ desaturateFactor = opt_desaturateFactor;
+ else
+ desaturateFactor = 1;
+
var hsl = this.toHSL();
- hsl.s = 0;
+ hsl.s = clamp01(hsl.s * (1 - desaturateFactor));
return Color.fromHSL(hsl);
},
« no previous file with comments | « no previous file | tracing/tracing/base/color_scheme.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698