Skip to content

Add support for color assets#42

Draft
darknoon wants to merge 1 commit into
insidegui:mainfrom
darknoon:main
Draft

Add support for color assets#42
darknoon wants to merge 1 commit into
insidegui:mainfrom
darknoon:main

Conversation

@darknoon

@darknoon darknoon commented Oct 24, 2025

Copy link
Copy Markdown

Summary

This PR adds support for reading and displaying color assets from .car files.

Changes

UI & Display

  • Colors display as solid color swatches in the collection view, and when QuickLook-ing
  • Updated UI strings to refer to "Assets" instead of "Images"

Export & Pasteboard

  • Colors export as files with color data (red, green, blue, alpha, hex)
  • Custom provides multiple pasteboard representations:
    • : Temporary PNG file for QuickLook preview
    • : NSColor object for pasting into Xcode/Interface Builder
    • : Hex format for sRGB, CSS color(display-p3 ...) for P3 colors
    • : TIFF image data for direct paste into image apps

Testing

Screenshot 2025-10-24 at 12 42 22 PM

Tested with Safari.'s Assets.car, reads colors ok

Comment on lines +482 to +493
// Create JSON representation of the color
CGFloat red = 0, green = 0, blue = 0, alpha = 0;
[rgbColor getRed:&red green:&green blue:&blue alpha:&alpha];

NSDictionary *colorInfo = @{
@"red": @(red),
@"green": @(green),
@"blue": @(blue),
@"alpha": @(alpha),
@"hex": [NSString stringWithFormat:@"#%02X%02X%02X", (int)(red * 255), (int)(green * 255), (int)(blue * 255)]
};

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, this is a bit out of sync with what goes on the pasteboard. (I used claude 4.5 for this and it went a bit haywire).
How do we think colors should be saved?

@xhruso00

Copy link
Copy Markdown

There are 2 issues:

  1. Transparent color images are shown as a solid color. They should be drawn differently.
  2. Missing category for color (system, darkAqua, accessibilitySystem, accessibilityDarkAqua)

Sample
Screenshot 2025-11-16 at 13 25 30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants