-
Notifications
You must be signed in to change notification settings - Fork 10
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
Generate the Semantic Colours as class members in Swift. #86
Conversation
Move core colours into their own class but leaving them as static.
import: ["SwiftUI"], | ||
objectType: "class", | ||
accessControl: "public", | ||
referenceClass: "CompoundCoreColorTokens" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is somewhat of a hack…
}).join('\n') | ||
%> | ||
|
||
<%= options.accessControl %> <%= options.objectType %> <%= file.className %> { | ||
<%= allProperties.map(function(prop) { | ||
return options.accessControl + ' let ' + formatProperty(prop); | ||
let formatted = formatProperty(prop); | ||
if (options.referenceClass) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
… but it works well enough to access the references from the correct class.
public static let bgSubtleSecondaryLevel0 = themeBg | ||
public static let bgCanvasDefaultLevel1 = gray300 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These 2 aren't used in the app as they're asymmetric and we still need to figure out how to generate them correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, and sorry that these little things aren't caught automatically by a linter. Hopefully I can get linting set up today!
Co-authored-by: Robin <robin@robin.town>
Co-authored-by: Robin <robin@robin.town>
The PR makes 2 changes to the Swift colour token generation (and can be reviewed commit-by-commit):
color
prefix from the colour tokens given they're all namespaced anyway.