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

Unified Diff: third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js

Issue 2832653002: DevTools: brush up color blending and theming APIs. (Closed)
Patch Set: Created 3 years, 8 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 | « third_party/WebKit/Source/devtools/front_end/timeline/TimelineFlameChartNetworkDataProvider.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js b/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js
index 48b5d1dbf9447ed4dceaf19fe99d950cbbbfae9c..7f114a2d93af93d86495dea7cfeee49d66dc775f 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js
@@ -1852,7 +1852,7 @@ UI.ThemeSupport = class {
output.push(':');
var items = value.replace(Common.Color.Regex, '\0$1\0').split('\0');
for (var i = 0; i < items.length; ++i)
- output.push(this.patchColor(items[i], colorUsage));
+ output.push(this.patchColorText(items[i], colorUsage));
if (style.getPropertyPriority(name))
output.push(' !important');
output.push(';');
@@ -1863,20 +1863,28 @@ UI.ThemeSupport = class {
* @param {!UI.ThemeSupport.ColorUsage} colorUsage
* @return {string}
*/
- patchColor(text, colorUsage) {
+ patchColorText(text, colorUsage) {
var color = Common.Color.parse(text);
if (!color)
return text;
+ var outColor = this.patchColor(color, colorUsage);
+ var outText = outColor.asString(null);
+ if (!outText)
+ outText = outColor.asString(outColor.hasAlpha() ? Common.Color.Format.RGBA : Common.Color.Format.RGB);
+ return outText || text;
+ }
+ /**
+ * @param {!Common.Color} color
+ * @param {!UI.ThemeSupport.ColorUsage} colorUsage
+ * @return {!Common.Color}
+ */
+ patchColor(color, colorUsage) {
var hsla = color.hsla();
this._patchHSLA(hsla, colorUsage);
var rgba = [];
Common.Color.hsl2rgb(hsla, rgba);
- var outColor = new Common.Color(rgba, color.format());
- var outText = outColor.asString(null);
- if (!outText)
- outText = outColor.asString(outColor.hasAlpha() ? Common.Color.Format.RGBA : Common.Color.Format.RGB);
- return outText || text;
+ return new Common.Color(rgba, color.format());
}
/**
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/timeline/TimelineFlameChartNetworkDataProvider.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698