-
Notifications
You must be signed in to change notification settings - Fork 1
/
pcolor.c
68 lines (68 loc) · 1.18 KB
/
pcolor.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/**
*
@file pcolor.c
*
@brief File to set printf() colors
*
* Not much on detailed description about pcolor
*
*
@author Vitor Santos, [email protected]
*
*
@internal
*
Created Oct-2017
*
Company University of Aveiro
*
Copyright Copyright (c) 2016-2017, Vitor Santos
*
* =====================================================================
*/
#include <stdio.h>
#include "pcolor.h"
/**
* @brief Set the color of text that follows upon the next printf.
*
* @param attr Type of attribute (RESET, BRIGHT, BLINK, etc...)
* @param fg Color of foreground
* @param bg Color of background
* @return Nothing
*/
void textcolor(int attr, int fg, int bg)
{
printf("%c[%d;%d;%dm", 0x1B, attr, fg + 30, bg + 40);
}
/**
* @brief printf of an horizontal separator red line
*
* @return Nothing
*/
void PrintRedLine(void)
{
int n;
textcolor(RESET, RED, WHITE);
//completar a função
for(n=0; n< 40; n++)
printf("=");
printf("\n");
}
/**
* @brief Reset color text
*
* @return Nothing
*/
void ResetTextColors(void)
{
textcolor(RESET, WHITE, GRAY); //completar a função
}
/**
* @brief Make somesort of highlight text
*
* @return Nothing
*/
void HighLightText(void)
{
textcolor(RESET, BLUE, YELLOW); //completar a função
}