{"id":13609850,"url":"https://github.com/trapd00r/File-LsColor","last_synced_at":"2025-04-12T22:32:01.008Z","repository":{"id":1357798,"uuid":"1305858","full_name":"trapd00r/File-LsColor","owner":"trapd00r","description":"Colorize input filenames just like ls(1) does","archived":false,"fork":false,"pushed_at":"2024-06-08T08:05:23.000Z","size":114,"stargazers_count":43,"open_issues_count":1,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-31T07:41:35.445Z","etag":null,"topics":["cli","colors","coreutils","dircolors","ls","lscolors","terminal","terminal-colors"],"latest_commit_sha":null,"homepage":"https://metacpan.org/release/File-LsColor","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/trapd00r.png","metadata":{"files":{"readme":"README","changelog":"Changes","contributing":null,"funding":".github/FUNDING.yml","license":null,"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":"trapd00r"}},"created_at":"2011-01-29T11:53:32.000Z","updated_at":"2024-11-06T17:55:05.000Z","dependencies_parsed_at":"2022-07-29T10:39:43.661Z","dependency_job_id":"f7053402-5bd5-492e-bf0e-e00e9e62c89e","html_url":"https://github.com/trapd00r/File-LsColor","commit_stats":{"total_commits":114,"total_committers":4,"mean_commits":28.5,"dds":"0.45614035087719296","last_synced_commit":"165aa5d383a5a8e030feed281f3aeaec5afce0fc"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trapd00r%2FFile-LsColor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trapd00r%2FFile-LsColor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trapd00r%2FFile-LsColor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trapd00r%2FFile-LsColor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trapd00r","download_url":"https://codeload.github.com/trapd00r/File-LsColor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248640780,"owners_count":21138093,"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":["cli","colors","coreutils","dircolors","ls","lscolors","terminal","terminal-colors"],"created_at":"2024-08-01T19:01:38.659Z","updated_at":"2025-04-12T22:32:00.766Z","avatar_url":"https://github.com/trapd00r.png","language":"Perl","funding_links":["https://github.com/sponsors/trapd00r"],"categories":["Perl"],"sub_categories":[],"readme":"NAME\n    File::LsColor - Colorize input filenames just like ls does\n\nSYNOPSIS\n        use File::LsColor qw(:all);\n        # Is equal to:\n        use File::LsColor qw(\n          ls_color\n          ls_color_custom\n          ls_color_default\n          ls_color_internal\n          get_ls_colors\n          can_ls_color\n          ls_color_lookup\n          parse_ls_colors\n        );\n\n\n        my @files = glob(\"$ENV{HOME}/*\");\n\n        print \"$_\\n\" for ls_color @files;\n\n        # or specify own pattern\n\n        @files = ls_color_custom('*.pl=38;5;196;1:*.pm=38;5;220', @files);\n\n        # or use the internal mappings\n\n        @files = ls_color_internal(@files);\n\n        # or use the defaults (only ANSI colors)\n\n        @files = ls_color_default(@files);\n\n\n        # returns a hashref with all defined filetypes and their attributes\n        my $ls_colors = get_ls_colors();\n\n        # what's the defined attributes for directories?\n\n        my $dir_color = can_ls_color('di');\n\n        # can we apply attributes to this filetype?\n        my $filetype = shift;\n        printf \"%s can be colored.\\n\" if can_ls_color($filetype);\n\n        # apply terminal color even if we can't use LS_COLORS to do so.\n        my $file_with_extension = 'foobar.flac';\n        printf \"%s looks nice.\\n\", can_ls_color($file_with_extension)\n          ? ls_color($file_with_extension)\n          : Term::ExtendedColor::fg(32, $file_with_extension);\n\nDESCRIPTION\n    This module provides functionality for using the LS_COLORS variable for\n    colorizing output in a way that's immediately recognized.\n\n    Say that you have a list of filenames that's the result of some complex\n    operation, and you wish to present the result to the user.\n\n    If said files have an extension and that extension is present in the\n    users LS_COLORS variable, they will be colored just like they would have\n    been if the filenames were output from ls(1) or tree(1).\n\nEXPORTS\n    None by default.\n\nFUNCTIONS\n  ls_color()\n    Arguments: @files | \\@files\n\n    Returns: @files | @files\n\n    Returns a list of filenames colored as specified by the environment\n    \"LS_COLORS\" variable. If the \"LS_COLORS\" variable is not set, throws an\n    exception. In this case, \"ls_color_internal()\" can be used.\n\n    In scalar context a string joined by '' is returned.\n\n  ls_color_default()\n    The same thing as \"ls_color()\", but uses the default LS_COLORS values\n    from GNU ls. Those are only ANSI colors.\n\n  ls_color_internal()\n    The same as \"ls_color()\", with one minor difference; Instead of using\n    the LS_COLORS variable from the environment, an internal specification\n    is used. This specification contains about 250 extensions as of this\n    writing.\n\n  ls_color_custom()\n    The first argument to \"ls_color_custom()\" should be a valid LS_COLORS\n    definition, like so:\n\n      ls_color_custom(\"*.pl=38;5;196:*.pm=38;5;197;1\", @perl_files);\n\n  get_ls_colors()\n    Returns a hash reference where a key is the extension and its value is\n    the attributes attached to it.\n\n  can_ls_color()\n    Arguments: $file Returns: $attributes\n\n    Given a valid name, returns the defined attributes associated with it.\n    Else, returns undef.\n\n  ls_color_lookup()\n    The same as can_ls_color(), exportable because of compatibility reasons.\n\n  parse_ls_colors()\n  Arguments: $string\n  Returns:   \\%hash\n    Returns a hashref with extension =\u003e attribute mappings, i.e:\n\n        '7z'  =\u003e '01;31',\n        'aac' =\u003e '00;36',\n        'ace' =\u003e '01;31',\n        'anx' =\u003e '01;35',\n        'arj' =\u003e '01;31',\n\nAUTHOR\n      Magnus Woldrich\n      CPAN ID: WOLDRICH\n      m@japh.se\n      http://japh.se\n      https://github.com/trapd00r\n\nREPORTING BUGS\n    Report bugs on \u003chttps://github.com/trapd00r/File-LsColor\u003e or to\n    m@japh.se\n\nCONTRIBUTORS\n    None required yet.\n\nCOPYRIGHT\n    Copyright 2011, 2018, 2019- the File::LsColor \"AUTHOR\" and\n    \"CONTRIBUTORS\" as listed above.\n\nLICENSE\n    This library is free software; you may redistribute it and/or modify it\n    under the same terms as Perl itself.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrapd00r%2FFile-LsColor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrapd00r%2FFile-LsColor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrapd00r%2FFile-LsColor/lists"}