Index: tracing/tracing/base/color_scheme.html |
diff --git a/tracing/tracing/base/color_scheme.html b/tracing/tracing/base/color_scheme.html |
index ea41399e877179ce1d6b7c462986241edf05ed10..662237ef43ef48be2e11741cd2226204ed809663 100644 |
--- a/tracing/tracing/base/color_scheme.html |
+++ b/tracing/tracing/base/color_scheme.html |
@@ -87,12 +87,12 @@ tr.exportTo('tr.b', function() { |
// Some constants we'll need for later lookups. |
var numGeneralPurposeColorIds = generalPurposeColors.length; |
var numReservedColorIds = tr.b.dictionaryLength(reservedColorsByName); |
- var numBaseColors = numGeneralPurposeColorIds + numReservedColorIds; |
+ var numColorsPerVariant = numGeneralPurposeColorIds + numReservedColorIds; |
class ColorScheme { |
}; |
- /** |
+ /* |
* A flat array of tr.b.Color values of the palette, and their variants. |
* |
* This array is made up of a set of base colors, repeated N times to form |
@@ -115,29 +115,56 @@ tr.exportTo('tr.b', function() { |
* 4: Brightened Generic Color 1 |
* 5: Brightened Named Color 'foo' |
*/ |
- ColorScheme.colors = (function() { |
- var paletteBase = []; |
- paletteBase.push.apply(paletteBase, generalPurposeColors); |
- paletteBase.push.apply(paletteBase, |
- tr.b.dictionaryValues(reservedColorsByName)); |
- |
- var combinedItems = []; |
- combinedItems.push.apply(combinedItems, |
- paletteBase); |
- combinedItems.push.apply(combinedItems, |
- paletteBase.map(function(c) { |
- return c.lighten(0.3, 0.9); |
- })); |
- combinedItems.push.apply(combinedItems, |
- paletteBase.map(function(c) { |
- return c.lighten(0.5, 0.9); |
- })); |
- combinedItems.push.apply(combinedItems, |
- paletteBase.map(function(c) { |
- return c.desaturate(); |
- })); |
- return combinedItems; |
- })(); |
+ var paletteBase = []; |
+ paletteBase.push.apply(paletteBase, generalPurposeColors); |
+ paletteBase.push.apply(paletteBase, |
+ tr.b.dictionaryValues(reservedColorsByName)); |
+ ColorScheme.colors = []; |
+ ColorScheme.properties = {}; |
+ ColorScheme.properties = { |
+ numColorsPerVariant: numColorsPerVariant |
+ }; |
+ |
+ function pushVariant(func) { |
+ var variantColors = paletteBase.map(func); |
+ ColorScheme.colors.push.apply(ColorScheme.colors, variantColors); |
+ } |
+ |
+ // Basic colors. |
+ pushVariant(function(c) { return c; }); |
+ |
+ // Brightened variants. |
+ ColorScheme.properties.brightenedOffsets = []; |
+ ColorScheme.properties.brightenedOffsets.push(ColorScheme.colors.length); |
+ pushVariant(function(c) { |
+ return c.lighten(0.3, 0.9); |
+ }); |
+ |
+ ColorScheme.properties.brightenedOffsets.push(ColorScheme.colors.length); |
+ pushVariant(function(c) { |
+ return c.lighten(0.48, 0.9); |
+ }); |
+ |
+ ColorScheme.properties.brightenedOffsets.push(ColorScheme.colors.length); |
+ pushVariant(function(c) { |
+ return c.lighten(0.65, 0.9); |
+ }); |
+ |
+ |
+ // Desaturated variants. |
+ ColorScheme.properties.dimmedOffsets = []; |
+ ColorScheme.properties.dimmedOffsets.push(ColorScheme.colors.length); |
+ pushVariant(function(c) { |
+ return c.desaturate(); |
+ }); |
+ ColorScheme.properties.dimmedOffsets.push(ColorScheme.colors.length); |
+ pushVariant(function(c) { |
+ return c.desaturate(0.5); |
+ }); |
+ ColorScheme.properties.dimmedOffsets.push(ColorScheme.colors.length); |
+ pushVariant(function(c) { |
+ return c.desaturate(0.3); |
+ }); |
/** |
* A toString'd representation of ColorScheme.colors. |
@@ -146,14 +173,6 @@ tr.exportTo('tr.b', function() { |
return c.toString(); |
}); |
- ColorScheme.properties = { |
- numBaseColors: numBaseColors, |
- numGeneralPurposeColorIds: numGeneralPurposeColorIds, |
- selectedIdBoost: numBaseColors, |
- highlightedIdBoost: numBaseColors * 2, |
- dimmedIdBoost: numBaseColors * 3 |
- }; |
- |
// Build reservedColorNameToIdMap. |
var reservedColorNameToIdMap = (function() { |
var m = {}; |