CabTheProgrammer / ConsolePrettify

A tool for making great UI in C console apps.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Console Prettify🎨 (alpha)

A simple tool for making good UI in C/C++ console applications on Windows with little effort.


How to Use 🖥️

Download or clone this repository. Copy prettify_functions.c and ConsolePrettify.h into your project folder and add #include "ConsolePrettify.h" in your C/C++ files.

Make sure the new files are correctly linked in your IDE/compiler.

Available Functions

Function Description
void prettify_textcolor(color) Changes the text color
void prettify_print(text, color) Prints text at the screen center
void prettify_textbox(specifier, variable, color) Displays an input field and reads user input
void prettify_textbox_password(variable, mask, color) Displays an input field with masking eg. *****
int prettify_menu(title, color, numOptions, ...) Displays a menu and returns the number of the selected option
void prettify_olist_i(title, color, items) Displays an ordered list of integers
void prettify_olist_f(title, color, items) Displays an ordered list of floats
void prettify_olist_c(title, color, items) Displays an ordered list of characters
void prettify_olist_s(title, color, items) Displays an ordered list of strings

NOTE: Please use prettify_textcolor() for all colored text in your program..


Available Colors 🌈

use any of these constants as the color arguments of prettify functions

Constant Name Value
RED 12
GREEN 10
LIGHT_BLUE 11
YELLOW 6
LIGHT_YELLOW 14
BLUE 9
PURPLE 5
WHITE 15
CYAN 3
GRAY 7
DARK_GRAY 8

Examples

Textboxes:

int num;
char password[25];

printf("THIS IS A TEXTBOX");
prettify_textbox("%i", &num, YELLOW);

printf("\nTHIS IS A PASSWORD TEXTBOX");
prettify_textbox_password(password, '+', BLUE);

Output

Menus

int choice = prettify_menu("Select an option", RED, 4,
                  "Buy bananas",
                  "Buy apple",
                  "Buy mango",
                  "Buy grapes");

Output

Lists

char **people = {"Justin", "Kim", "Susan"};
prettify_list_ordered("List of People", GREEN, people);

Output

TODO

  • Add automatic Table printing
  • Print to center

License


ConsolePrettify is MIT licensed.

About

A tool for making great UI in C console apps.

License:MIT License


Languages

Language:C 100.0%