Xmipp  v3.23.11-Nereus
Functions
xmipp_color.cpp File Reference
#include "xmipp_color.h"
Include dependency graph for xmipp_color.cpp:

Go to the source code of this file.

Functions

String colorString (const char *msg, int color, int attribute, int bgcolor)
 

Function Documentation

◆ colorString()

String colorString ( const char *  msg,
int  color,
int  attribute,
int  bgcolor 
)

Definition at line 28 of file xmipp_color.cpp.

29 {
30  size_t n = strlen(msg);
31  char *formatBuffer = new char[n+20]; // Extra space for color characters
32  sprintf(formatBuffer, "%c[%d;%dm%s%c[0m", 0x1B, attribute, color + 30, msg, 0x1B);
33  String s = formatBuffer;
34  delete[] formatBuffer;
35  return s;
36 }
std::string String
Definition: xmipp_strings.h:34
int * n