csscolorparser-zig
csscolorparser-zig
csscolorparser-zig is a Zig library for parsing CSS color string as defined in the W3C’s CSS Color Module Level 4.
Usage
Add this package to your build.zig.zon:
zig fetch --save git+https://github.com/sorairolake/csscolorparser-zig.git
Add the following to your build.zig:
const csscolorparser = b.dependency("csscolorparser", .{});
exe.root_module.addImport("csscolorparser", csscolorparser.module("csscolorparser"));
Supported color formats
- Named colors
- RGB hexadecimal notations
- 6 digits (
#RRGGBB) - 8 digits (
#RRGGBBAA) - 3 digits (
#RGB) - 4 digits (
#RGBA)
- 6 digits (
rgb()andrgba()hsl()andhsla()hwb()lab()lch()oklab()oklch()color()
Documentation
See the documentation for more details.
Zig version
This library is compatible with Zig version 0.16.0.
Source code
The upstream repository is available at https://github.com/sorairolake/csscolorparser-zig.git.
Changelog
Please see CHANGELOG.adoc.
Contributing
Please see CONTRIBUTING.adoc.
Acknowledgment
This library is ported from both the csscolorparser crate in Rust and the
github.com/mazznoer/csscolorparser package in Go.
The csscolorparser crate v0.7.0 is distributed under the terms of either the
Apache License 2.0 or the MIT License, and the
github.com/mazznoer/csscolorparser package v0.1.5 is distributed under the
terms of the MIT License.
License
Copyright (C) 2025 Shun Sakai (see AUTHORS.adoc)
This library is distributed under the terms of either the Apache License 2.0 or the MIT License.
This project is compliant with version 3.3 of the REUSE Specification. See copyright notices of individual files for more details on copyright and licensing information.