sorairolake/csscolorparser-zig
Zig CSS color parser library
csscolorparser-zig is a Zig library for parsing CSS color string as defined in the W3C's CSS Color Module Level 4.
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"));
Named colors
RGB hexadecimal notations
6 digits (#RRGGBB
)
8 digits (#RRGGBBAA
)
3 digits (#RGB
)
4 digits (#RGBA
)
rgb()
and rgba()
hsl()
and hsla()
hwb()
lab()
lch()
oklab()
oklch()
color()
To build the documentation:
zig build doc
The result is generated in zig-out/doc/csscolorparser
.
If you want to preview this, run a HTTP server locally. For example:
python -m http.server -d zig-out/doc/csscolorparser
Then open http://localhost:8000/
in your browser.
This library is compatible with Zig version 0.14.0.
The upstream repository is available at https://github.com/sorairolake/csscolorparser-zig.git.
Please see CHANGELOG.adoc.
Please see CONTRIBUTING.adoc.
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.
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.