SwiftGen / StencilSwiftKit

A framework bringing additional nodes & filters to Stencil dedicated to Swift code generation
MIT License
289 stars 55 forks source link

HEX Data for Colors.xcassets #145

Closed mYoda closed 2 years ago

mYoda commented 2 years ago

Trying to add comments to my custom template for colors from .xcassets Catalog. But seems there is no that data. Is it possible to get data from Contents.json from each color? Actually, there is contains a data for that...

Currently we have the next data in {asset} variable in templates:

["type": "color", "value": "backgroundGreen", "name": "backgroundGreen"]

Actually the result should be like this:

/// x339933
static let backgroundGreen = UIColor(name: "backgroundGreen")

This will really be helpful for development since you can't remember all values for each name. When you checking UI design and colors - that comment will help to quickly find the right value without "xcassets" Catalog checking. Thanks!

djbe commented 2 years ago

This is the wrong repository for this issue, you want the SwiftGen repository.

Anyway, you'll find that your question has already been asked here: https://github.com/SwiftGen/SwiftGen/issues/847