Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ziglibs/lscolors
A zig library for colorizing paths according to LS_COLORS
https://github.com/ziglibs/lscolors
ls-colors zig zig-package ziglang
Last synced: 2 months ago
JSON representation
A zig library for colorizing paths according to LS_COLORS
- Host: GitHub
- URL: https://github.com/ziglibs/lscolors
- Owner: ziglibs
- License: mit
- Created: 2019-11-03T15:47:57.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-08-18T17:45:28.000Z (5 months ago)
- Last Synced: 2024-08-18T19:05:07.550Z (5 months ago)
- Topics: ls-colors, zig, zig-package, ziglang
- Language: Zig
- Homepage:
- Size: 73.2 KB
- Stars: 14
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-zig - lscolors🗒️A zig library for colorizing paths according to LS_COLORS
README
# lscolors
![CI](https://github.com/ziglibs/zig-lscolors/workflows/CI/badge.svg)
A zig library for colorizing paths according to the `LS_COLORS`
environment variable. Designed to work with Zig 0.13.0.## Quick Example
```zig
const std = @import("std");const LsColors = @import("lscolors").LsColors;
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();
const allocator = gpa.allocator();var lsc = try LsColors.fromEnv(allocator);
defer lsc.deinit();var dir = try std.fs.cwd().openIterableDir(".", .{});
defer dir.close();var iterator = dir.iterate();
while (try iterator.next()) |itm| {
std.log.info("{}", .{try lsc.styled(itm.name)});
}
}
```