{"id":13596588,"url":"https://github.com/joonro/Get-ChildItemColor","last_synced_at":"2025-04-09T16:33:13.196Z","repository":{"id":15286085,"uuid":"18015594","full_name":"joonro/Get-ChildItemColor","owner":"joonro","description":"Get-ChildItemColor provides colorized version of Get-ChildItem Cmdlet of PowerShell.","archived":false,"fork":false,"pushed_at":"2024-08-04T17:04:37.000Z","size":393,"stargazers_count":325,"open_issues_count":1,"forks_count":34,"subscribers_count":5,"default_branch":"develop","last_synced_at":"2024-11-06T19:45:53.560Z","etag":null,"topics":["color","get-childitem","ls","powershell"],"latest_commit_sha":null,"homepage":"","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/joonro.png","metadata":{"files":{"readme":"README.org","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}},"created_at":"2014-03-22T17:37:16.000Z","updated_at":"2024-09-30T22:04:35.000Z","dependencies_parsed_at":"2024-08-01T16:41:40.042Z","dependency_job_id":"3c0ef7fa-5b1c-479a-99fd-90d7a3dd2a95","html_url":"https://github.com/joonro/Get-ChildItemColor","commit_stats":null,"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joonro%2FGet-ChildItemColor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joonro%2FGet-ChildItemColor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joonro%2FGet-ChildItemColor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joonro%2FGet-ChildItemColor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joonro","download_url":"https://codeload.github.com/joonro/Get-ChildItemColor/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248067998,"owners_count":21042397,"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":["color","get-childitem","ls","powershell"],"created_at":"2024-08-01T16:02:35.157Z","updated_at":"2025-04-09T16:33:08.187Z","avatar_url":"https://github.com/joonro.png","language":"PowerShell","funding_links":[],"categories":["PowerShell"],"sub_categories":[],"readme":"# Created 2019-07-20 Sat 10:30\n#+TITLE: Get-ChildItemColor\n#+AUTHOR: Joon Ro\n\n=Get-ChildItemColor= provides colorization of outputs of ~Get-ChildItem~\nCmdlet of PowerShell. It is based on Tim Johnson's [[http://tasteofpowershell.blogspot.com/2009/02/get-childitem-dir-results-color-coded.html][script,]] another [[http://mow001.blogspot.com/2006/01/colorized-msh-ls-replacement.html][script]]\nby [[http://thepowershellguy.com/][the PowerShell Guy]], and [[https://github.com/Davlind/PSColor][PSColor]]. \n\nIt provides two main functionalities:\n\n1. ~Get-ChildItemColor~, which adds coloring to the output of\n   ~Get-ChildItem~. \n2. ~Get-ChildItemColorFormatWide~, which is colored version of\n   ~Get-ChildItemColor | Format-Wide~. This uses ~Write-Host~ to output\n   coloring, because ~Get-ChildItemColor | Format-Wide~ does not allow\n   multiple colors in one line.\n\n=Get-ChildItemColor= has the following features:\n\n- Both functions support pipelines --- they are pipeline-aware, so they just return\n  untouhed output of ~Get-ChildItem~ when used as a part of a pipeline.\n- As of v3.0.0, it no longer overloads ~Out-Default~, and thus does not have\n  unintended consequences.\n- Both functions work as intended inside OneDrive directories.\n\n* Screenshots\n** Get-ChildItemColor\n[[file:./screenshots/Get-ChildItemColor.png]] \n** Get-ChildItemColorFormatWide (=ls= equivalent)\n[[file:./screenshots/Get-ChildItemColorFormatWide.png]] \n* Install\n** Install from [[https://www.powershellgallery.com/packages/Get-ChildItemColor/][PowerShellGallery]]\nPowerShellGet is required, which is included in Windows 10 and WMF5. If you\nare using PowerShell V3 or V4, you will need to install [[https://www.microsoft.com/en-us/download/details.aspx?id=49186][PowerShellGet]].\n\nThen, you can run =Install-Module Get-ChildItemColor=.\n** Install from GitHub\nAfter cloning the repo, you can put files in =/src= folder into\n=Get-ChildItemColor= folder under your =PSModulePath= \n(e.g., =$ENV:UserProfile\\Documents\\PowerShell\\Modules= for PowerShell 6 and\nlater). The =master= branch always contains the latest release version.\n** Install from [[https://chocolatey.org][Chocolatey]]\nThe module is available as a [[https://chocolatey.org/packages/get-childitemcolor][Chocolatey package]]. Install it using =choco install get-childitemcolor=.\n\n** Easiest way to use it in PowerShell 7\nDownload the sources from github.\n\nInput in Powershell the command\n  =$Env:PSModulePath=\nand look in the directories, which are there listed.\n\nIn the directory you search for, are already directories like \"CimCmdlets\", \"Microsoft.PowerShell.Archive\" and other.\nGo to this directory called \"Modules\" and input in the PowerShell\n  =mkdir Get-ChildItemColor=\nGo then in the created directory Get-ChildItemColor and copy inside it the files in the \"src\" directory of github called\n \"FileInfo.ps1\", \"Get-ChildItemColor.psd1\", \"Get-ChildItemColor.psm1\", \"Get-ChildItemColorTable.ps1\", \"MatchInfo.ps1\",\n \"ProcessInfo.ps1\", \"PSColorHelper.ps1\", \"ServiceController.ps1\"\n\nNow input in the Powershell the command\n  =$PROFILE=\nIt outputs now the file, where the Powershell looks for initialization.\nIf the directory to that file not exists, creating it.\nAnd if the file not exists, creating it, too.\nNow open the file in an text-editor like notepad.exe for example with\n=notepad $PROFILE=\n\n\nInput there the lines\n\n#+begin_src powershell\nImport-Module Get-ChildItemColor\nSet-Alias -Name dir -Value Get-ChildItemColor -Option AllScope\nSet-Alias -Name ls -Value Get-ChildItemColorFormatWide\n#+end_src\n\nand save it.\nNow start the PowerShell again.\nWith the command \"dir\" you have a colord file list. With \"ls\" it is then in wide mode. And \"gci\" is still as default the old colorless output.\nYou can also use the outwritten normal commands \"Get-ChildItemColor\", \"Get-ChildItemColorFormatWide\" and \"Get-ChildItem\".\n\n* Usage\nWhen you import the module:\n\n#+begin_src powershell\nImport-Module Get-ChildItemColor\n#+end_src\n\nit provides two functions, =Get-ChildItemColorFormatWide= and\n=Get-ChildItemColor=.\n\nYou can add aliases to these functions for convenience. For example, I have\nthe following in my profile[fn:pathProfile] (please do not put this into ISE\nprofile[fn:pathProfileISE] as it does not work in ISE):\n\n#+begin_src powershell\nIf (-Not (Test-Path Variable:PSise)) {  # Only run this in the console and not in the ISE\n    Import-Module Get-ChildItemColor\n    \n    Set-Alias l Get-ChildItemColor -option AllScope\n    Set-Alias ls Get-ChildItemColorFormatWide -option AllScope [-HideHeader] [-TrailingSlashDirectory]\n}\n#+end_src\n\nSo =l= yields colored output of =Get-ChildItem= and =ls= yields colored output\nof =Get-ChildItem | Format-Wide= equivalent.\n\n~Get-ChildItemColorFormatWide~ has the following optional switches:\n\n- -HideHeader :: supress printing of headers (path on top).\n- -TrailingSlashDirectory :: add a trailing slash to directory names.\n \n[fn:pathProfile] ~$Home\\[My ]Documents\\PowerShell\\Profile.ps1~ or ~$Home\\[My ]Documents\\WindowsPowerShell\\Profile.ps1~ \n\n[fn:pathProfileISE] ~$Home\\[My ]Documents\\WindowsPowerShell\\Microsoft.PowerShellISE_profile.ps1~\n\n** Customizing color\nOne can dynamically change the color scheme for different items, thanks to [[https://github.com/asidlo][asidlo]]'s [[https://github.com/joonro/Get-ChildItemColor/pull/23][contribution]].\nSee the example below.\n\n#+begin_src powershell\n# Change color for directories to Blue\n$GetChildItemColorTable.File['Directory'] = \"Blue\"\n\n# Change color for executables to Green\nForEach ($Exe in $GetChildItemColorExtensions['ExecutableList']) {\n    $GetChildItemColorTable.File[$Exe] = \"Green\"\n}\n#+end_src\n** Adding a new category\nOne can create a new category and assign colors easily like the example below.\n#+begin_src powershell\n$GetChildItemColorExtensions['OfficeList'] = @(\n    \".docx\",\n    \".pdf\",\n    \".pptx\",\n    \".xlsx\"\n)\n\nForEach ($Extension in $GetChildItemColorExtensions['OfficeList']) {\n    $GetChildItemColorTable.File.Add($Extension, \"Green\")\n}\n#+end_src\n** Customizing vertical space\nYou can adjust the vertical spacing using =$Global:GetChildItemColorVerticalSpace=. Default is 1 (PowerShell's \ndefault is 2).\n\n#+begin_src powershell\n$Global:GetChildItemColorVerticalSpace = 1\n#+end_src\n* Authors\n- [[http://github.com/joonro][Joon Ro]].\n* Changelog\n- See [[https://github.com/joonro/Get-ChildItemColor/releases][Releases]] for newer changelog.\n** v2.4.0\n- Add ~HideHeader~ switch to ~Get-ChildItemColorFormatWide~ ([[https://github.com/joonro/Get-ChildItemColor/issues/29][#29]])\n** v2.3.0\n- Better handling of header printout ([[https://github.com/joonro/Get-ChildItemColor/issues/41][#41]])\n** v2.2.2\n- Add instructions about adding a new category.\n** v2.2.1\n- [[https://github.com/joonro/Get-ChildItemColor/pull/44][Fix uint32 error in cell width calculation]]. (Thanks to [[https://github.com/DanielCarmingham][DanielCarmingham]])\n- [[https://github.com/joonro/Get-ChildItemColor/pull/35][Add Chocolatey install instructions]]. (Thanks to [[https://github.com/pauby][pauby]])\n** v2.2.0\n- Fix #27, Display issue with Chinese. (Thanks to [[https://github.com/shiena][shiena]])\n** v2.1.1\n- BUGFIX: Print directory names correctly when =-Recurse= option is used\n** v2.1.0\n- Re-organize folder structure\n** v2.0.0\n- Incorporate [[https://github.com/Davlind/PSColor][PSColor]]'s implementation of coloring the output of\n  =Get-ChildItem=.\n- Add =$Global:GetChildItemColorVerticalSpace= option.\n** v1.3.1\n- PR #21: Added ReparsePoint (symlink) detection, matched color scheme with\n  Linux (thanks to [[https://github.com/cmilanf][cmilanf]])\n- Make empty lines consistent between Get-ChildItemColor and\n  Get-ChildItemColorFormatWide (Fixes [[https://github.com/joonro/Get-ChildItemColor/issues/17][#17]])\n** v1.3.0\n- PR [[https://github.com/joonro/Get-ChildItemColor/pull/23][#23]]: Added customizable color output. (thanks to [[https://github.com/asidlo][asidlo]])\n- Improve README\n** v1.2.3\n- Add LICENSE\n** v1.2.2\n- Improve README (#15)\n- Beautify code\n** v1.2.1\n- PR #13: Fallback to Gray when no =OriginalForegroundColor= (thanks to [[https://github.com/joonro/Get-ChildItemColor/issues?q=is%3Apr+author%3Amikesigs][mikesigs]])\n- PR #12: Fix a typo (thanks to [[https://github.com/joonro/Get-ChildItemColor/issues?q=is%3Apr+author%3Ajqly][jqly]])\n** v1.2.0\n- Robust to non-file entries (Issue #10)\n** v1.1.0\n- Revert back to previous implementation of =Get-ChildItemColorFormatWide=\n** v1.0.0\n- The script changes =$Host.UI.RawUI.ForegroundColor= only and keep the item object intact\n- =Get-ChildItemColorFormatWide= is basically =Get-ChildItemColor | Format-Wide=\n** v0.5.3\n- Better performance by reducing if's\n- Proper printing of =DirectoryEntry= for =FormatWide= case\n** v0.5.2\n- Published on PowerShellGallery\n- Refactoring; separate out two functions\n** v0.4.2\n- Make it a PowerShell module\n** v0.4.1\n- Returns vanila =Get-Childitem= results for =DictionaryEntry= cases.\n** v0.4.0\n- Make function names consistent to the PowerShell naming convention (#8)\n- Use parameters more consistently, =-Path= works with paths with spaces (#3),\n  and =-Force= works (#9)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoonro%2FGet-ChildItemColor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoonro%2FGet-ChildItemColor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoonro%2FGet-ChildItemColor/lists"}