2005-12-29 11:03:18 +00:00
|
|
|
|
/** @file color.c \brief Color output for terminals.
|
|
|
|
|
*
|
|
|
|
|
* Depends on the switches (to disable them with a --plain switch)
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include "switches.h"
|
|
|
|
|
|
2006-01-02 21:06:08 +00:00
|
|
|
|
//! Substitution string for --plain output
|
2005-12-29 11:03:18 +00:00
|
|
|
|
char *empty = "";
|
2006-01-02 21:06:08 +00:00
|
|
|
|
//! Reset colors
|
2005-12-29 11:03:18 +00:00
|
|
|
|
char *COLOR_Reset = "[0m";
|
2006-01-02 21:06:08 +00:00
|
|
|
|
//! Red
|
2005-12-29 11:03:18 +00:00
|
|
|
|
char *COLOR_Red = "[31m";
|
2006-01-02 21:06:08 +00:00
|
|
|
|
//! Green
|
2005-12-29 11:03:18 +00:00
|
|
|
|
char *COLOR_Green = "[32m";
|
2006-01-02 21:06:08 +00:00
|
|
|
|
//! Bold
|
2005-12-29 11:03:18 +00:00
|
|
|
|
char *COLOR_Bold = "[1m";
|
|
|
|
|
|
2006-01-02 21:06:08 +00:00
|
|
|
|
//! Init colors
|
2005-12-29 11:03:18 +00:00
|
|
|
|
void
|
|
|
|
|
colorInit (void)
|
|
|
|
|
{
|
|
|
|
|
if (switches.plain)
|
|
|
|
|
{
|
|
|
|
|
COLOR_Reset = empty;
|
|
|
|
|
COLOR_Red = empty;
|
|
|
|
|
COLOR_Green = empty;
|
|
|
|
|
COLOR_Bold = empty;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-01-02 21:06:08 +00:00
|
|
|
|
//! Exit colors
|
2005-12-29 11:03:18 +00:00
|
|
|
|
void
|
|
|
|
|
colorDone (void)
|
|
|
|
|
{
|
|
|
|
|
}
|