CHashTable 1
Loading...
Searching...
No Matches
fprintf_color.c File Reference

printf function with colored output using ANSI escape codes More...

#include <stdio.h>
#include <stdarg.h>
#include "fprintf_color.h"
Include dependency graph for fprintf_color.c:

Functions

void fprintf_color (FILE *stream, ColorCode color_code, const char *format,...)
 Prints a formatted string to stdout in a specified color.
 

Variables

static const char * colors []
 

Detailed Description

printf function with colored output using ANSI escape codes

Function Documentation

◆ fprintf_color()

void fprintf_color ( FILE *  stream,
ColorCode  color_code,
const char *  format,
  ... 
)

Prints a formatted string to stdout in a specified color.

Parameters
codeThe ColorCode enum value (e.g., COLOR_RED)
formatThe printf-style format string
...The variable arguments for the format string.

Variable Documentation

◆ colors

const char* colors[]
static
Initial value:
= {
[COLOR_RESET] = "\033[0m",
[COLOR_RED] = "\033[31m",
[COLOR_GREEN] = "\033[32m",
[COLOR_BLUE] = "\033[34m",
[COLOR_BOLD_RED] = "\033[1;31m"
}