Skip to content

Instantly share code, notes, and snippets.

@o-nnerb
Last active July 1, 2021 22:46
Show Gist options
  • Save o-nnerb/69cb656982c5acb17ace93ac157fcda4 to your computer and use it in GitHub Desktop.
Save o-nnerb/69cb656982c5acb17ace93ac157fcda4 to your computer and use it in GitHub Desktop.
Implementation of DSColors with distinct properties
public struct DSColors<Color: ColorType>: ColorProvider {
public var primary: ColorScale<Color> {
ColorScale {
transformHandler("primary.\(%0)")
}
}
public var complementary: ColorStyle<Color> {
ColorStyle {
transformHandler("complementary.\(%0)")
}
}
public var neutral: ColorVariant<ColorScale<Color>> {
ColorVariant { variant in
ColorScale { scale in
transformHandler("neutral.\(variant).\(scale)")
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment