Commit a755f704 authored by Paul Lewis's avatar Paul Lewis Committed by Commit Bot

[DevTools] Sorts colors descending by luminance

Change-Id: Ibe628e70b3d53db9ca132378c2da2ac42cd7746c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1847337
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: default avatarMathias Bynens <mathias@chromium.org>
Cr-Commit-Position: refs/heads/master@{#704570}
parent 8e82c6ab
...@@ -192,17 +192,20 @@ CssOverview.CSSOverviewCompletedView = class extends UI.PanelWithSidebar { ...@@ -192,17 +192,20 @@ CssOverview.CSSOverviewCompletedView = class extends UI.PanelWithSidebar {
return blockFragment; return blockFragment;
} }
_getNonTransparentColorStrings(colors) { _getNonTransparentColorStrings(srcColors) {
return Array.from(colors) const colors = [];
.map(colorText => { for (const colorText of Array.from(srcColors)) {
const color = Common.Color.parse(colorText); const color = Common.Color.parse(colorText);
if (color.rgba()[3] === 0) { if (color.rgba()[3] === 0) {
return; continue;
} }
return color; colors.push(color);
}) }
.filter(color => !!color);
return colors.sort((colorA, colorB) => {
return Common.Color.luminance(colorB.rgba()) - Common.Color.luminance(colorA.rgba());
});
} }
setOverviewData(data) { setOverviewData(data) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment