c-template
colors.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <unistd.h>
#include "../../include/utils/colors.h"
Include dependency graph for colors.c:

Go to the source code of this file.

Functions

char * get_ansi_color_scheme (COLORS color)
 returns an ansi color string to be used with printf More...
 
char * format_colored (COLORS color, char *message)
 returns a char * with the message formatted with ansi colors More...
 
void print_colored (COLORS color, char *message)
 prints message to stdout with the given color More...
 
int write_colored (COLORS color, int file_descriptor, char *message)
 writes a message to fh with the given color For "sync writes" and to always flush logs to disk immediately set do_flush to true returns 0 if no error, returns 1 if error More...
 

Function Documentation

◆ format_colored()

char* format_colored ( COLORS  color,
char *  message 
)

returns a char * with the message formatted with ansi colors

Definition at line 31 of file colors.c.

Here is the call graph for this function:

◆ get_ansi_color_scheme()

char* get_ansi_color_scheme ( COLORS  color)

returns an ansi color string to be used with printf

Definition at line 8 of file colors.c.

Here is the caller graph for this function:

◆ print_colored()

void print_colored ( COLORS  color,
char *  message 
)

prints message to stdout with the given color

Definition at line 43 of file colors.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_colored()

int write_colored ( COLORS  color,
int  file_descriptor,
char *  message 
)

writes a message to fh with the given color For "sync writes" and to always flush logs to disk immediately set do_flush to true returns 0 if no error, returns 1 if error

Definition at line 47 of file colors.c.

Here is the call graph for this function: