Hi,
I’m working on a macOS app that includes a file browser component. And I’m trying to match Finder’s behavior for color tags and folder icons.
For local files/folders everything works fine:
Tag color key returns the expected label number via
NSColor * labelColor = nil;
[fileURL getResourceValue:&labelColor forKey:NSURLLabelColorKey error:nil];
NSNumber * labelKey = nil;
[fileURL getResourceValue:&labelKey forKey:NSURLLabelNumberKey error:nil];
QLThumbnailGenerator obtains the expected colored folder icon (including emoji/symbol overlay if set) via
QLThumbnailGenerationRequest * request =
[[QLThumbnailGenerationRequest alloc] initWithFileAtURL:fileURL
size:iconSize
scale:scaleFactor
representationTypes:QLThumbnailGenerationRequestRepresentationTypeIcon];
request.iconMode = YES;
[[QLThumbnailGenerator sharedGenerator] generateBestRepresentationForRequest:request
completionHandler:^(QLThumbnailRepresentation * _Nullable thumbnail, NSError * _Nullable error) {
if (thumbnail != nil && error == nil)
{
NSImage * thumbnailImage = [thumbnail NSImage];
// ...
}
}];
However, for items on iCloud Drive (whether currently downloaded locally or only stored in the cloud), the same code always produces gray colors, while Finder shows everything correctly:
NSURLLabelNumberKey always returns 1 (gray) for items with color tags, and 0 for non-tagged.
Folder icons returned via QLThumbnailGenerator are gray, no emoji/symbol overlays.
Reading tag data from xattr gives values like “Green\1” (tag name matches, but numeric value is still "Gray").
Also, if I move a correctly-tagged local item into iCloud Drive, it immediately becomes gray in my app (Finder still shows the correct colors).
Question:
What is the supported way to retrieve Finder tag colors and the correct folder icon appearance (color + overlays) for items in iCloud Drive, so that the result matches Finder?
I am on macOS Tahoe 26.2/26.3, Xcode 26.2 (17C52).
If you need any additional details, please let me know.
Thanks!
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags:
Files and Storage
QuickLook Thumbnailing
iCloud Drive