Skip to content

Functions #33

Description

@BernardGatt

In values we're proposing the introduction of a set of reserved keywords that will serve as functions, by version 1 there will be a number of functions available:

ImageURL

{
    "@logoImageURL": "https://avatars1.githubusercontent.com/u/17726261",
    "MyApp.LoginView": {
        "MyApp.LogoView": {
            "backgroundImage": "ImageURL(@logoImageURL)"
        }
    }
}

Gradient

{
    "@primaryColor": "#641E16",
    "@secondaryColor": "#78281F",
    "MyApp.LoginView": {
        "backgroundColor": "Gradient(style: 'Horizontal', locations: [0.9, 1.0], colors: [@primaryColor, @secondaryColor])"
    }
}

Alpha

{
    "@primaryColor": "#641E16",
    "MyApp.LoginView": {
        "UILabel": {
            "tintColor": "@primaryColor"
        },
        "UIButton": {
            "backgroundColor": "Alpha(@primaryColor, 80)"
        }
    }
}

In addition to these functions StyleKit will also provide a function registry so developers can add their own custom functions.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions