{"id":13559471,"url":"https://github.com/sharkdp/lscolors","last_synced_at":"2025-04-08T02:41:37.846Z","repository":{"id":33725230,"uuid":"161029451","full_name":"sharkdp/lscolors","owner":"sharkdp","description":"A Rust library and tool to colorize paths using LS_COLORS","archived":false,"fork":false,"pushed_at":"2024-04-10T00:59:09.000Z","size":125,"stargazers_count":253,"open_issues_count":11,"forks_count":17,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-04-15T00:15:11.477Z","etag":null,"topics":["ansi-colors","command-line","filesystem","hacktoberfest","ls-colors","rust","shell","terminal"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sharkdp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","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},"funding":{"github":"sharkdp"}},"created_at":"2018-12-09T10:50:01.000Z","updated_at":"2024-08-19T16:24:32.425Z","dependencies_parsed_at":"2024-01-14T10:59:39.034Z","dependency_job_id":"fa31c7a4-e0c8-4b42-a1d3-23bc2a52b5e0","html_url":"https://github.com/sharkdp/lscolors","commit_stats":{"total_commits":150,"total_committers":17,"mean_commits":8.823529411764707,"dds":"0.43333333333333335","last_synced_commit":"2cba9d72a412c008d336f34343b52f00d052e455"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharkdp%2Flscolors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharkdp%2Flscolors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharkdp%2Flscolors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharkdp%2Flscolors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sharkdp","download_url":"https://codeload.github.com/sharkdp/lscolors/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247767232,"owners_count":20992538,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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-colors","command-line","filesystem","hacktoberfest","ls-colors","rust","shell","terminal"],"created_at":"2024-08-01T13:00:26.422Z","updated_at":"2025-04-08T02:41:37.818Z","avatar_url":"https://github.com/sharkdp.png","language":"Rust","funding_links":["https://github.com/sponsors/sharkdp"],"categories":["Rust","FileSystem"],"sub_categories":[],"readme":"# lscolors\n\n[![CICD](https://github.com/sharkdp/lscolors/actions/workflows/CICD.yml/badge.svg)](https://github.com/sharkdp/lscolors/actions/workflows/CICD.yml)\n[![Crates.io](https://img.shields.io/crates/v/lscolors.svg)](https://crates.io/crates/lscolors)\n[![Documentation](https://docs.rs/lscolors/badge.svg)](https://docs.rs/lscolors)\n\nA cross-platform library for colorizing paths according to the `LS_COLORS` environment variable (like `ls`).\n\n## Usage\n\n\u003cimg src=\"https://i.imgur.com/RE4Ont5.png\" align=\"right\"\u003e\n\n```rust\nuse lscolors::{LsColors, Style};\n\nlet lscolors = LsColors::from_env().unwrap_or_default();\n\nlet path = \"some/folder/test.tar.gz\";\nlet style = lscolors.style_for_path(path);\n\n// If you want to use `ansi_term`:\nlet ansi_style = style.map(Style::to_ansi_term_style)\n                      .unwrap_or_default();\nprintln!(\"{}\", ansi_style.paint(path));\n\n// If you want to use `nu-ansi-term` (fork of ansi_term) or `gnu_legacy`:\nlet nu_ansi_style = style.map(Style::to_nu_ansi_term_style)\n                      .unwrap_or_default();\nprintln!(\"{}\", nu_ansi_style.paint(path));\n\n// If you want to use `crossterm`:\nlet crossterm_style = style.map(Style::to_crossterm_style)\n                      .unwrap_or_default();\nprintln!(\"{}\", crossterm_style.apply(path));\n```\n\n## Command-line application\n\nThis crate also comes with a small command-line program `lscolors` that\ncan be used to colorize the output of other commands:\n\n```bash\n\u003e find . -maxdepth 2 | lscolors\n\n\u003e rg foo -l | lscolors\n```\n\nYou can install it by running `cargo install lscolors` or by downloading one\nof the prebuilt binaries from the [release page](https://github.com/sharkdp/lscolors/releases).\nIf you want to build the application from source, you can run\n\n```rs\ncargo build --release --features=nu-ansi-term --locked\n```\n\n## Features\n\n```rust\n// Cargo.toml\n\n[dependencies]\n// use ansi-term coloring\nlscolors = { version = \"v0.14.0\", features = [\"ansi_term\"] }\n// use crossterm coloring\nlscolors = { version = \"v0.14.0\", features = [\"crossterm\"] }\n// use nu-ansi-term coloring\nlscolors = { version = \"v0.14.0\", features = [\"nu-ansi-term\"] }\n// use nu-ansi-term coloring in gnu legacy mode with double digit styles\nlscolors = { version = \"v0.14.0\", features = [\"gnu_legacy\"] }\n```\n\n## License\n\nLicensed under either of\n\n* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\n## References\n\nInformation about the `LS_COLORS` environment variable is sparse. Here is a short list of useful references:\n\n* [`LS_COLORS` implementation in the GNU coreutils version of `ls`](https://github.com/coreutils/coreutils/blob/17983b2cb3bccbb4fa69691178caddd99269bda9/src/ls.c#L2507-L2647) (the reference implementation)\n* [`LS_COLORS` implementation in `bfs`](https://github.com/tavianator/bfs/blob/2.6/src/color.c#L556) by [**@tavianator**](https://github.com/tavianator)\n* [The `DIR_COLORS(5)` man page](https://linux.die.net/man/5/dir_colors)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsharkdp%2Flscolors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsharkdp%2Flscolors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsharkdp%2Flscolors/lists"}