Skip to content

nitrogenez/prism

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status License Language

Table of Contents

Description

Prism is a utility library for managing colors and colorspaces written in Zig.

WARNING
There are ongoing major API changes. Please, be cautious
and follow the development process. All changes are
documented in the code directly. Old API is already
set to be deprecated.

Why Prism?

Prism is lightweight, fast, and easy to use in general. There is no boilerplate, just import the library, and start using colors and convert them into any of supported colorspaces, including CIE l*a*b*, which is a highly useful colorspace for working with colors that our eyes actually percept.

Usage

To use Prism you must have the source code in your project. You can either clone it, or download as an archive.

To then use it in your project, add the following to your project's build.zig:

const prism = b.createModule(.{
    .source_file = .{ .path = "/path/to/prism.zig"},
});

your_exe_or_lib.addModule("prism", prism);

Building

To build Prism as a standalone library you must need Zig 0.11.0. Then just go into the Prism project root via cd, and then use zig build to build Prism. Use zig test src/tests.zig to run tests.

Contributing

All the files must be formatted and linted with zig fmt. The code must be consistent and clean. If needed, use // zig fmt: off and // zig fmt: on comments.

If you are willing to make Prism better (or worse), you may follow the instructions:

  1. Fork Prism
  2. Create a new branch using git, e.g git checkout -b feat/myfeat
  3. Write your dream code
  4. Add your changes and make a commit:
    • git add src/prism.zig
    • git commit -m "me make code"
  5. Open a merge request
  6. Wait for any contributor to review your code
  7. Go get some tea, because the review may take a while
  8. Make changes if requested by a reviewer as described previousely
  9. You're GTG, enjoy your profile pic in a contributors list :)

Colorspace Support

NAME STATE NEW
CMYK FULL NO
HSI PARTIAL IN TODOS
HSL FULL FULL
LAB FULL IN TODOS
YIQ PARITAL NO
HSV FULL PARTIAL
RGB FULL FULL
XYZ FULL FULL

Meaning

  • NAME - Name of the colorspace
  • STATE - A colorspace support state
    • FULL - A full-featured colorspace support
    • PARTIAL - It kinda works, but is lacking functionality
    • NO - No support at all
    • IN TODOS - Planned and yet to be implemented

License

Prism is licensed under a BSD-3-Clause "New" or "Revised" License. See LICENSE to learn more.