/*********************************************************************** * Copyright (C) 2021 Prosource (CLI Systems LLC) * https://prosource.dev * * License: * THIS SOURCE CODE IS PART OF THE prosource.dev EMBEDDED SYSTEM * KNOWLEDGE-BASE. This source code is a Free Solution as defined * in the Prosource Usage License and is provided under the * Creative Commons Attribution 4.0 International (CC BY 4.0) license * as defined at https://creativecommons.org/licenses/by/4.0/ * * This source code and all software distributed under the License are * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED * ***********************************************************************/ #ifndef __VT100COLORS_H__ #define __VT100COLORS_H__ // This header file can be used for setting output console colors // on VT100 consoles. #define BACKGROUND_COLOR_NORMAL '4' #define FOREGROUND_COLOR_NORMAL '3' #define FOREGROUND_COLOR_LIGHT '9' //#define FGCOLORSET FOREGROUND_COLOR_NORMAL #define FGCOLORSET FOREGROUND_COLOR_LIGHT #define VTCOLOR_BLACK '0' #define VTCOLOR_RED '1' #define VTCOLOR_GREEN '2' #define VTCOLOR_YELLOW '3' #define VTCOLOR_BLUE '4' #define VTCOLOR_MAGENTA '5' #define VTCOLOR_CYAN '6' #define VTCOLOR_GRAY '7' #define VTCOLOR_DEFAULT '9' #define FOREGROUND_COLOR(B,C) printf("%c%c%c%c%c", 0x1B, '[', (B), (C),'m') #define BACKGROUND_COLOR(C) printf("%c%c%c%c%c", 0x1B, '[', BACKGROUND_COLOR_NORMAL, (C),'m') #define RED() FOREGROUND_COLOR(FGCOLORSET, VTCOLOR_RED) #define GREEN() FOREGROUND_COLOR(FGCOLORSET, VTCOLOR_GREEN) #define YELLOW() FOREGROUND_COLOR(FGCOLORSET, VTCOLOR_YELLOW) #define BLUE() FOREGROUND_COLOR(FGCOLORSET, VTCOLOR_BLUE) #define WHITE() FOREGROUND_COLOR(FGCOLORSET, VTCOLOR_GRAY) #define MAGENTA() FOREGROUND_COLOR(FGCOLORSET, VTCOLOR_MAGENTA) #define CYAN() FOREGROUND_COLOR(FGCOLORSET, VTCOLOR_CYAN) #define GRAY() FOREGROUND_COLOR(FGCOLORSET, VTCOLOR_GRAY) #define BLACK() FOREGROUND_COLOR(FGCOLORSET, VTCOLOR_BLACK) #define NOCOLOR() FOREGROUND_COLOR(FGCOLORSET, VTCOLOR_GRAY) #define BG_RED() BACKGROUND_COLOR(VTCOLOR_RED) #define BG_GREEN() BACKGROUND_COLOR(VTCOLOR_GREEN) #define BG_YELLOW() BACKGROUND_COLOR(VTCOLOR_YELLOW) #define BG_BLUE() BACKGROUND_COLOR(VTCOLOR_BLUE) #define BG_WHITE() BACKGROUND_COLOR(VTCOLOR_GRAY) #define BG_CYAN() BACKGROUND_COLOR(VTCOLOR_CYAN) #define BG_GRAY() BACKGROUND_COLOR(VTCOLOR_GRAY) #define BG_BLACK() BACKGROUND_COLOR(VTCOLOR_BLACK) #define BG_MAGENTA() BACKGROUND_COLOR(VTCOLOR_MAGENTA) #define BG_NONE() BACKGROUND_COLOR(VTCOLOR_DEFAULT) #define NORMAL() printf("%c%c%c%c", 0x1B, '[', '0', 'm') #define BOLD() printf("%c%c%c%c", 0x1B, '[', '1', 'm') #define LOWINT() printf("%c%c%c%c", 0x1B, '[', '2', 'm') #define ITALIC() printf("%c%c%c%c", 0x1B, '[', '3', 'm') #define UL() printf("%c%c%c%c", 0x1B, '[', '4', 'm') #define UL2() printf("%c%c%s%c", 0x1B, '[', "21", 'm') #define UL3() printf("%c%c%s%c", 0x1B, '[', "4:3", 'm') #define BLINK() printf("%c%c%c%c", 0x1B, '[', '5', 'm') #define OL() printf("%c%c%s%c", 0x1B, '[', "53", 'm') #define INV() printf("%c%c%c%c", 0x1B, '[', '7', 'm') #define HIDDEN() printf("%c%c%c%c", 0x1B, '[', '8', 'm') #define STRIKE() printf("%c%c%c%c", 0x1B, '[', '9', 'm') #endif