public History(ThingCount[] thingCounts, Color[] colors = null) { // get range of colors if not set if (colors == null) { // default to white for single line if (thingCounts.Length == 1) { colors = new[] { Color.white }; } // rainbow! else { colors = HSV_Helper.Range(thingCounts.Length); } } // create a chapter for each label for (var i = 0; i < thingCounts.Length; i++) { _chapters.Add(new Chapter(new ThingCountClass(thingCounts[i].ThingDef, thingCounts[i].Count), Size, colors[i % colors.Length])); } // show all by default _chaptersShown.AddRange(_chapters); }
public History(string[] labels, Color[] colors = null) { #if DEBUG_HISTORY Log.Message("History created" + string.Join(", ", labels)); #endif // get range of colors if not set if (colors == null) { // default to white for single line if (labels.Length == 1) { colors = new[] { Color.white }; } // rainbow! else { colors = HSV_Helper.Range(labels.Length); } } // create a chapter for each label for (var i = 0; i < labels.Length; i++) { _chapters.Add(new Chapter(labels[i], Size, colors[i % colors.Length])); } // show all by default _chaptersShown.AddRange(_chapters); }