use of com.gitblit.utils.ColorFactory in project gitblit by gitblit.
the class BlamePage method initializeColors.
private Map<?, String> initializeColors(BlameType blameType, List<AnnotatedLine> lines) {
ColorFactory colorFactory = new ColorFactory();
Map<?, String> colorMap;
if (BlameType.AGE == blameType) {
Set<Date> keys = new TreeSet<Date>(new Comparator<Date>() {
@Override
public int compare(Date o1, Date o2) {
// younger code has a brighter, older code lightens to white
return o1.compareTo(o2);
}
});
for (AnnotatedLine line : lines) {
keys.add(line.when);
}
// TODO consider making this a setting
colorMap = colorFactory.getGraduatedColorMap(keys, Color.decode("#FFA63A"));
} else {
Set<String> keys = new HashSet<String>();
for (AnnotatedLine line : lines) {
if (blameType == BlameType.AUTHOR) {
keys.add(line.author);
} else {
keys.add(line.commitId);
}
}
colorMap = colorFactory.getRandomColorMap(keys);
}
return colorMap;
}
Aggregations