Skip to main content

finder_colors.py

Set or inspect the colors that Apple OSX Finder assigns to files or folders.

Usable as a standalone script, or it can be imported as a python module.

Standalone Usage:

To find out the color of a file or folder:

finder_colors.py $filename

returns:

filename    colorname

You can check multiple files at once, with:

finder_colors.py $file1 $file2 $file3

or from the shell, wildcards

finder_colors.py *.txt

To set the color:

finder_colors.py $color $filename

You can assign multiple files at once by:

finder_colors.py $color $filename $filename2 $filename3 $etc

so in a shell:

finder_colors.py red *.py

would set all python scripts to red.

Options for colors are:

none, gray, green, purple, blue, yellow, red, orange

If you’re worried that you may have files in the list which could be valid color names, then simply invoke using path names ( ./filename rather than filename, or with wildcards ./* rather than *).

This is good practice in general.

As a python module:

After installing (by PIP):

>>> import finder_colors
>>> finder_colors.get('/path/to/file')
'none'

>>> finder_colors.set('/path/to/file', 'red')
'\x00........'

The value returned by set(pathname, color) is the complete com.apple.FinderInfo attribute list of that file. You can probably ignore it.

Installation:

Either with pip

pip install finder_colors

Or simply download the finder_colors.py script, and put it somewhere in your $PATH (usually /usr/local/bin works…) and run

chmod +x /usr/local/bin/finder_colors.py

Licence:

MIT Licenced, so pretty much do what you want with it. Here’s the details:

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Enjoy!

Metadata

Release files for finder_colors 0.9.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for finder_colors 0.9.5
File Size Uploaded
finder_colors-0.9.5.tar.gz 4.1 kB Details

Release files / finder_colors-0.9.5.tar.gz

Download URL finder_colors-0.9.5.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
3d9b7c1aa2e5729898c83674dcaeb31944d21d420c3bfa3c24aea9f5e9e398b6
BLAKE2b-256 checksum
How to use checksums
b350784dcf6e325978d6384a438cd50d4fbfc79f6cddcb481e7c0d80e5d78108
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.9.5 This release

1 release file

0.9.3

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page