{"id":29778867,"url":"https://github.com/thomasfazzari1/zig-colors","last_synced_at":"2026-04-16T11:02:55.412Z","repository":{"id":305207328,"uuid":"1022214566","full_name":"thomasfazzari1/zig-colors","owner":"thomasfazzari1","description":"Beautiful terminal colors for Zig","archived":false,"fork":false,"pushed_at":"2025-07-25T13:03:01.000Z","size":26,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-27T13:02:07.103Z","etag":null,"topics":["ansi","ansi-colors","colors","console","cross-platform","hex-colors","rgb","styling","terminal","terminal-colors","tui","zig"],"latest_commit_sha":null,"homepage":"https://thomasfazzari1.github.io/zig-colors-docs/","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thomasfazzari1.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-18T16:43:46.000Z","updated_at":"2025-07-25T13:02:03.000Z","dependencies_parsed_at":"2025-07-18T23:15:56.319Z","dependency_job_id":"214c3576-17b0-42b9-8419-9932d2e9c5f5","html_url":"https://github.com/thomasfazzari1/zig-colors","commit_stats":null,"previous_names":["thomasfazzari1/zig-colors"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/thomasfazzari1/zig-colors","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasfazzari1%2Fzig-colors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasfazzari1%2Fzig-colors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasfazzari1%2Fzig-colors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasfazzari1%2Fzig-colors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thomasfazzari1","download_url":"https://codeload.github.com/thomasfazzari1/zig-colors/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasfazzari1%2Fzig-colors/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31882886,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T09:23:21.276Z","status":"ssl_error","status_checked_at":"2026-04-16T09:23:15.028Z","response_time":69,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansi","ansi-colors","colors","console","cross-platform","hex-colors","rgb","styling","terminal","terminal-colors","tui","zig"],"created_at":"2025-07-27T13:01:24.506Z","updated_at":"2026-04-16T11:02:55.382Z","avatar_url":"https://github.com/thomasfazzari1.png","language":"Zig","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cpicture\u003e\n    \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\".github/assets/zig-colors-dark.svg\"\u003e\n    \u003csource media=\"(prefers-color-scheme: light)\" srcset=\".github/assets/zig-colors-light.svg\"\u003e\n    \u003cimg alt=\"zig-colors\" src=\".github/assets/zig-colors-light.svg\" width=\"600\"\u003e\n  \u003c/picture\u003e\n\n[![CI](https://github.com/thomasfazzari1/zig-colors/workflows/CI/badge.svg)](https://github.com/thomasfazzari1/zig-colors/actions)\n[![Zig 0.13.0](https://img.shields.io/badge/zig-0.13.0-orange.svg)](https://ziglang.org)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n\u003c/div\u003e\n\n## Features\n\n- **Full color support** - 16 colors, 256 colors, and RGB/Hex (16M colors)\n- **Chainable API** - Intuitive and composable: `red.bold().underline()`\n- **Zero dependencies** - Pure Zig implementation\n- **Auto-detection** - Automatically detects terminal capabilities\n- **Cross-platform** - Works on Windows, macOS, and Linux\n- **Extensive styling** - Bold, dim, italic, underline, and more\n\n## Installation\n\nAdd `zig-colors` to your `build.zig.zon`:\n\n```zig\n.{\n    .name = \"my-project\",\n    .version = \"0.1.0\",\n    .dependencies = .{\n        .@\"zig-colors\" = .{\n            .url = \"https://github.com/thomasfazzari1/zig-colors/archive/refs/tags/v0.1.0.tar.gz\",\n            .hash = \"1220331bffdeca5488ee0a3a73f9c274f9856b63006d22b7fa2b810eb8a3fb9db867\",\n        },\n    },\n}\n```\n\nThen in your build.zig:\n\n```zig\nzigconst colors_dep = b.dependency(\"zig-colors\", .{});\nexe.root_module.addImport(\"zig-colors\", colors_dep.module(\"zig-colors\"));\n```\n\n## Quick Start\n\n```zig\nconst std = @import(\"std\");\nconst colors = @import(\"zig-colors\");\n\npub fn main() !void {\n    // Initialize color support detection\n    colors.init();\n    defer colors.deinit();\n\n    // Simple colors\n    std.debug.print(\"{}\\n\", .{colors.red.call(\"Error!\")});\n    std.debug.print(\"{}\\n\", .{colors.green.bold().call(\"Success!\")});\n\n    // Background colors\n    std.debug.print(\"{}\\n\", .{colors.white.bgBlue().call(\"Info\")});\n\n    // RGB/Hex colors (if terminal supports it)\n    const style = colors.Style{};\n    std.debug.print(\"{}\\n\", .{style.hex(\"#FF6B6B\").bold().call(\"Custom color!\")});\n}\n```\n\n## Usage Examples\n\n### Basic Colors\n\n```zig\n// Foreground colors\ncolors.red.call(\"Red text\")\ncolors.green.call(\"Green text\")\ncolors.blue.call(\"Blue text\")\ncolors.yellow.call(\"Yellow text\")\ncolors.magenta.call(\"Magenta text\")\ncolors.cyan.call(\"Cyan text\")\ncolors.white.call(\"White text\")\ncolors.black.call(\"Black text\")\n\n// Bright variants\ncolors.brightRed.call(\"Bright red\")\ncolors.brightGreen.call(\"Bright green\")\n// ... and more\n```\n\n### Text Styles\n\n```zig\ncolors.bold.call(\"Bold text\")\ncolors.dim.call(\"Dim text\")\ncolors.italic.call(\"Italic text\")\ncolors.underline.call(\"Underlined text\")\n```\n\n### Styles Chaining\n\n```zig\n// Combine multiple styles\ncolors.red.bold().underline().call(\"Important error!\")\ncolors.green.italic().call(\"Emphasized success\")\ncolors.yellow.dim().call(\"Subtle warning\")\n\n// Complex combinations\ncolors.white.bgRed().bold().call(\"Alert!\")\ncolors.brightBlue.bgBlack().underline().call(\"Highlighted\")\n```\n\n### Background Colors\n\n```zig\n// Using background methods\ncolors.white.bgRed().call(\"White on red\")\ncolors.black.bgGreen().call(\"Black on green\")\n\n// Using the bg namespace\ncolors.bg.yellow().black().call(\"Black on yellow\")\ncolors.bg.blue().white().bold().call(\"Bold white on blue\")\n```\n\n### RGB \u0026 Hex Colors\n\n```zig\n// RGB colors (requires truecolor terminal support)\nconst style = colors.Style{};\nstyle.rgb(255, 107, 107).call(\"Custom RGB\")\nstyle.rgb(100, 200, 255).bold().call(\"Bold custom blue\")\n\n// Hex colors\nstyle.hex(\"#FF6B6B\").call(\"Hex color\")\nstyle.hex(\"#00CED1\").underline().call(\"Underlined hex\")\n\n// RGB backgrounds\ncolors.white.bgRgb(50, 50, 50).call(\"White on dark gray\")\ncolors.black.bgHex(\"#FFD700\").call(\"Black on gold\")\n```\n\n### Conditional Styling\n\n```zig\n// Only style if colors are supported\nif (colors.isSupported()) {\n    std.debug.print(\"{}\\n\", .{colors.green.call(\"✓ Colors supported!\")});\n} else {\n    std.debug.print(\"Colors not supported\\n\", .{});\n}\n\n// Check color level\nconst level = colors.getLevel();\nif (level == .truecolor) {\n    // Use RGB colors\n    const style = colors.Style{};\n    std.debug.print(\"{}\\n\", .{style.hex(\"#FF6B6B\").call(\"Truecolor!\")});\n}\n```\n\n### Building a Logger\n\n```zig\nconst Logger = struct {\n    const err = colors.red.bold();\n    const warn = colors.yellow;\n    const info = colors.blue;\n    const success = colors.green.bold();\n\n    pub fn logError(msg: []const u8) void {\n        std.debug.print(\"{} {s}\\n\", .{err.call(\"ERROR:\"), msg});\n    }\n\n    pub fn logWarn(msg: []const u8) void {\n        std.debug.print(\"{} {s}\\n\", .{warn.call(\"WARN:\"), msg});\n    }\n\n    pub fn logInfo(msg: []const u8) void {\n        std.debug.print(\"{} {s}\\n\", .{info.call(\"INFO:\"), msg});\n    }\n\n    pub fn logSuccess(msg: []const u8) void {\n        std.debug.print(\"{} {s}\\n\", .{success.call(\"SUCCESS:\"), msg});\n    }\n};\n```\n\n## API Reference\n\nFor complete API documentation, visit the **[full documentation](https://thomasfazzari1.github.io/zig-colors-docs/)**.\n\n## Testing\n\nThe library includes comprehensive tests:\n\n```bash\n# Run unit tests\nzig build test\n\n# Run visual demo\nzig build demo\n```\n\n## License\n\nThis project is licensed under the Apache License 2.0 - See [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomasfazzari1%2Fzig-colors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthomasfazzari1%2Fzig-colors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomasfazzari1%2Fzig-colors/lists"}