Skip to content

hanilr/variation-ui

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vn VARIATION UI vn

Variation-ui is single-header terminal user interface library. Written in ansi-c. Simple to use, easy to learn and has small codebase. Also updatable thanks to MIT license (Look license if you want to know more).

vn_info Dependencies:

  • gcc > Gnu Compiler Collection
  • make > Gnu Make

vn_warn Important Note vn_warn

You need to define #define VN_UI_IMPLEMENTATION before #include "vn_ui.h"

#define VN_UI_IMPLEMENTATION
#include "vn_ui.h"

vn_example Example vn_example

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define VN_UI_IMPLEMENTATION // Base features
#define VN_WIDGET // Widget features
#include "vn_ui.h"

int main()
{
  /* Color declaring */
  char* color_fg_red = vn_color("#e93737", 'f');
  char* color_bg_blue = vn_color("#3737e9", 'b');

  /* Text attribute */
  VN_UI_TEXT vnt;
  strcpy(vnt.color_fg, color_fg_red);
  strcpy(vnt.color_bg, color_bg_blue);
  strcpy(vnt.text_style, vn_text_bold);

  /* Widget values */
  VN_UI_WIDGET vnw;
  vnw.pos_x = 2;
  vnw.pos_y = 2;
  vnw.width = 20;
  vnw.height = 10;

  /* UI Section */
  vn_bg(' ', vnt, vnw); // Background
  vn_gotoxy((vnw.pos_x + vnw.width) / 2, (vnw.pos_y + vnw.height) / 2); // Go to middle
  vn_print("This is the example.", 'y', vnt.color_fg, vnt.color_bg, vnt.text_style); // Colourful printing
  vn_gotoxy((vnw.pos_x + vnw.width), (vnw.pos_y + vnw.height)); // Go to end

  // Free after use 'vn_color'
  free(color_fg_red);
  free(color_bg_blue);

  return 0;
}

vn Compiling as shared-library or Using as default vn

Show make list make or make run

  make run

vn_warn You can compile as shared-library and develope os specific projects. vn_warn

vn_example How should I compile? vn_example

  make compile

Unix shared-library (.so)

Windows shared-library (.dll)

If you want to delete this file you can use make clean

vn_example What if I want to use as default? vn_example

  make install

vn_wiki : vn_warn You can take a look to wiki page if you want learn more! vn_warn

Check Other Variation Libraries

About

Single-header terminal user interface library. Written in ansi-c

Topics

Resources

License

Stars

Watchers

Forks