Skip to content

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

License

Notifications You must be signed in to change notification settings

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_warn If you don't need widget, then there's a lite version of this library. It's also optimized and simplified and contains no widgets. Variation Lite UI

vn_info Dependencies:

  • gcc > Gnu Compiler Collection
  • make > Gnu Make

You can install with package managers for linux.

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>

#define VN_UI_IMPLEMENTATION
#define VN_COLOR
#define VN_WIDGET
#include "vn_ui.h"

int main()
{
  struct vn_init vn;
  vn.width = 60;
  vn.height = 5;
  vn.pos_x = 2;
  vn.pos_y = 2;

  struct vnc_color white;
  struct vnc_color black;
  
  white.is_fore = 0;
  white.color = vn_hex_color("e9e9e9", white.is_fore);
  black.is_fore = 1;
  black.color = vn_rgb_color(22, 22, 22, black.is_fore);
  
  char* msg = "This is the example. If you had a trouble please leave an issue to https://github.com/hanilr/variation/issues have fun!";
  
  vn_clear();
  vn_label(vn.pos_x, vn.pos_y, vn.width, vn.height, black.color, white.color, text_italic, msg);
  vn_end(vn);

  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)

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

If you only want to download library with terminal then use curl tool

curl -fLo /usr/include/vn/vn_ui.h --create-dirs https://raw.githubusercontent.com/hanilr/variation-ui/master/vn_ui.h

If you use curl tool then you need to compile with sudo.

You can find in /usr/include/vn/

If you want to uninstall you can use make uninstall

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

License

MIT License

Copyright (c) 2022 Hakkı Anıl Ragıboğlu

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.