zeplin-extension-documentation icon indicating copy to clipboard operation
zeplin-extension-documentation copied to clipboard

Name of colors

Open artemnovichkov opened this issue 7 years ago • 2 comments

I have a color in Styleguide named #black8 but a color property of a shadow or a border have undefined name. Example of using:

function cgColor(color, useColorNames) {
    if (useColorNames && color.name) {
        return "UIColor." + color.name + ".cgColor\n"
    }
    return uiColor(color.r, color.g, color.b, color.a) + ".cgColor\n"
}

artemnovichkov avatar Feb 23 '18 12:02 artemnovichkov

You can get the named instance of a color object using Project.findColorEqual if it's in the project's styleguide. Honestly, this does not seem so intuitive so I think we'll change this so that every color/textStyle properties will have their name set if they are included in the project's styleguide.

dirtybit avatar Feb 23 '18 12:02 dirtybit

It works, thanks!

view.layer.shadowColor = UIColor.black8.cgColor

artemnovichkov avatar Feb 23 '18 13:02 artemnovichkov