There are seven predefined tag colors with color-specific names (including the transparent None tag). These are "system" font colors. If you have no custom tag names defined, and drop a file on your drive that does have a custom tag name from another machine, or create your own new custom tag name, two things will happen.
- The new .plist file /Users/username/Library/SyncedPreferences/com.apple.finder.plist will be created, and the new tag name added to it.
- A new custom tag name entry will be placed in the Finder Preferences > Tags panel. It may need you to activate it though.
The key to my script finding all available user-defined and system tag names is that their right-most column in the Finder Preferences > Tags panel must have some indication [√-] that it is activated. I just ran this script on macOS 11.2.3 and it found all of my tags save for one that was not activated.
In the script, the allTags variable is a list of all found tag names, and when used in the choose from list allTags, that creates the following neat list display of found tag names:
If all you want is a list of currently defined tag names, then the following AppleScript will produce that list in the display dialog:
(*
Generate an inclusive list of standard and user defined tag names
Tested: macOS 11.2.3
Author: VikingOSX, 2021-03-09, Apple Support Communities, no warranties
*)
use framework "AppKit"
use scripting additions
property NSWorkspace : a reference to current application's NSWorkspace
set tagfile to POSIX path of ((path to home folder as text) & "Library:SyncedPreferences:com.apple.finder.plist") as text
set keyPath to "values:FinderTagDict:value:FinderTags"
set AWKCMD to " | awk '/n/ {print substr($0, index($0, $3))}'"
-- if custom tag names were created in Finder this file will exist
if exists ((POSIX file tagfile) as alias) = true then
set allTags to paragraphs of (do shell script "/usr/libexec/PlistBuddy -c \"print " & keyPath & "\" " & tagfile's quoted form & AWKCMD)
else
-- no custom tag names exist, so get default Finder tag names
set allTags to NSWorkspace's sharedWorkspace()'s fileLabels() as list
end if
if exists (allTags) is true then
set {TID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, return}
display dialog (items of allTags) as text with title "User Defined Tag Names"
set AppleScript's text item delimiters to TID
end if
return
Which produces this: