Ansicodes

This commit is contained in:
Imbus 2025-09-14 13:30:11 +02:00
parent d4da05253d
commit 80825e620c
3 changed files with 136 additions and 0 deletions

58
ansicodes/main.c Normal file
View file

@ -0,0 +1,58 @@
#include "ansi.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
int main(int argc, char *argv[]) {
if (!isatty(STDOUT_FILENO) || !(getenv("TERM") && strcmp(getenv("TERM"), "dumb") != 0)) {
printf("This terminal does not seem to support ANSI\n");
exit(EXIT_FAILURE);
}
printf(ANSI_BOLD "ABCDE" ANSI_RESET "\n");
printf(ANSI_DIM "ABCDE" ANSI_RESET "\n");
printf(ANSI_UNDER "ABCDE" ANSI_RESET "\n");
printf(ANSI_BLINK "ABCDE" ANSI_RESET "\n");
printf(ANSI_REV "ABCDE" ANSI_RESET "\n");
printf(ANSI_HIDDEN "ABCDE" ANSI_RESET "\n");
printf(ANSI_FG_BLACK "ABCDE" ANSI_RESET "\n");
printf(ANSI_FG_RED "ABCDE" ANSI_RESET "\n");
printf(ANSI_FG_GREEN "ABCDE" ANSI_RESET "\n");
printf(ANSI_FG_YELLOW "ABCDE" ANSI_RESET "\n");
printf(ANSI_FG_BLUE "ABCDE" ANSI_RESET "\n");
printf(ANSI_FG_MAGENTA "ABCDE" ANSI_RESET "\n");
printf(ANSI_FG_CYAN "ABCDE" ANSI_RESET "\n");
printf(ANSI_FG_WHITE "ABCDE" ANSI_RESET "\n");
printf(ANSI_FG_BBLACK "ABCDE" ANSI_RESET "\n");
printf(ANSI_FG_BRED "ABCDE" ANSI_RESET "\n");
printf(ANSI_FG_BGREEN "ABCDE" ANSI_RESET "\n");
printf(ANSI_FG_BYELLOW "ABCDE" ANSI_RESET "\n");
printf(ANSI_FG_BBLUE "ABCDE" ANSI_RESET "\n");
printf(ANSI_FG_BMAGENTA "ABCDE" ANSI_RESET "\n");
printf(ANSI_FG_BCYAN "ABCDE" ANSI_RESET "\n");
printf(ANSI_FG_BWHITE "ABCDE" ANSI_RESET "\n");
printf(ANSI_BG_BLACK "ABCDE" ANSI_RESET "\n");
printf(ANSI_BG_RED "ABCDE" ANSI_RESET "\n");
printf(ANSI_BG_GREEN "ABCDE" ANSI_RESET "\n");
printf(ANSI_BG_YELLOW "ABCDE" ANSI_RESET "\n");
printf(ANSI_BG_BLUE "ABCDE" ANSI_RESET "\n");
printf(ANSI_BG_MAGENTA "ABCDE" ANSI_RESET "\n");
printf(ANSI_BG_CYAN "ABCDE" ANSI_RESET "\n");
printf(ANSI_BG_WHITE "ABCDE" ANSI_RESET "\n");
printf(ANSI_BG_BBLACK "ABCDE" ANSI_RESET "\n");
printf(ANSI_BG_BRED "ABCDE" ANSI_RESET "\n");
printf(ANSI_BG_BGREEN "ABCDE" ANSI_RESET "\n");
printf(ANSI_BG_BYELLOW "ABCDE" ANSI_RESET "\n");
printf(ANSI_BG_BBLUE "ABCDE" ANSI_RESET "\n");
printf(ANSI_BG_BMAGENTA "ABCDE" ANSI_RESET "\n");
printf(ANSI_BG_BCYAN "ABCDE" ANSI_RESET "\n");
printf(ANSI_BG_BWHITE "ABCDE" ANSI_RESET "\n");
exit(EXIT_SUCCESS);
}