Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Name of colors #7

Open
artemnovichkov opened this issue Feb 23, 2018 · 2 comments
Open

Name of colors #7

artemnovichkov opened this issue Feb 23, 2018 · 2 comments

Comments

@artemnovichkov
Copy link

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"
}
@dirtybit
Copy link
Contributor

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.

@artemnovichkov
Copy link
Author

It works, thanks!

view.layer.shadowColor = UIColor.black8.cgColor

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

No branches or pull requests

3 participants