8000 GitHub - judah-caruso/schemes.jai: A Jai library for working with Schemes
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

judah-caruso/schemes.jai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Schemes.jai

A small library for working with Schemes.

Usage

# Manual management
mkdir vendor && cd vendor/
git clone https://github.com/judah-caruso/schemes.jai Scheme
#import "Basic";
#import "Scheme";

main :: () {
   file, read_ok := read_entire_file("my-scheme.svg");
   assert(read_ok);

   scheme, ok, err := read_scheme(file);
   if !ok {
      log_error("Error while reading scheme file: %", err);
      return;
   }

   log("Opened scheme '%' %", scheme.title, scheme.palette);

   // Apply/work with scheme colors
   // Scheme.c0-c7   : Scheme_Color;
   // Scheme.palette : [8]Scheme_Color;

   log("The hex value of c3 is: %", to_hex(scheme.c3));

   // Export SVG scheme from structure
   svg := export_scheme(scheme);

   log("Exported svg:\n%", svg);
}

Notes

  • All error strings returned by read_scheme are allocated with the temporary allocator.
  • read_scheme takes an allocator argument (default: context) which is used for the title.
  • export_scheme takes an allocator argument (default: context) which is used for the output SVG.
  • to_hex allocates a new string using the temporary allocator.

About

A Jai library for working with Schemes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0