From 1e3d4119d21df2812584a09a18d35414efbc1336 Mon Sep 17 00:00:00 2001 From: Johan Herland Date: Tue, 13 Jul 2010 23:23:39 +0200 Subject: Enable custom schemes for column colors in the graph API Currently, the graph code is hardcoded to use ANSI color escapes for coloring the column characters in the generated graphs. This patch allows a custom scheme of colors to be set at runtime, allowing different types of color escapes to be used. A new function - graph_set_column_colors() - is added to the graph.h API, which allows a custom column_colors array (and column_colors_max value) to replace the builtin ANSI array (and _max value). The new function - if used - must be called before graph_init() is called. Signed-off-by: Johan Herland Signed-off-by: Junio C Hamano --- graph.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'graph.h') diff --git a/graph.h b/graph.h index f188168158..aff960c7e8 100644 --- a/graph.h +++ b/graph.h @@ -4,6 +4,23 @@ /* A graph is a pointer to this opaque structure */ struct git_graph; +/* + * Set up a custom scheme for column colors. + * + * The default column color scheme inserts ANSI color escapes to colorize + * the graph. The various color escapes are stored in an array of strings + * where each entry corresponds to a color, except for the last entry, + * which denotes the escape for resetting the color back to the default. + * When generating the graph, strings from this array are inserted before + * and after the various column characters. + * + * This function allows you to enable a custom array of color escapes. + * The 'colors_max' argument is the index of the last "reset" entry. + * + * This functions must be called BEFORE graph_init() is called. + */ +void graph_set_column_colors(const char **colors, unsigned short colors_max); + /* * Create a new struct git_graph. */ -- cgit v1.2.3