-
Notifications
You must be signed in to change notification settings - Fork 6
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
feat: add configuration for android jetpack compose output #223
base: main
Are you sure you want to change the base?
Conversation
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.
A couple of comments.
Also remember you can run npm run format
🤓
config/shared.js
Outdated
@@ -133,6 +133,18 @@ StyleDictionary.registerTransform({ | |||
transformer: StyleDictionary.transform['color/css'].transformer, | |||
}); | |||
|
|||
StyleDictionary.registerTransform({ |
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 register call could live in compose.config.js
since it's actually not shared with other configs.
config/compose.config.js
Outdated
{ | ||
const formatted = token.path.map(el => format(el)) | ||
token.name = `Telekom${formatted.toString().replace(/,/g, '')}` | ||
return token | ||
} |
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 looks like this filter function is being misused (it works nevertheless). The filter function should only do the checks and return a boolean.
For formatting the name you could register a custom tranform of type
"name". I think it works the same was as value transform, you return the new name instead of setting it in the token object.
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.
thanks i was still a bit unsure about when/where to use transformers vs filters (even though the name should give it away)
they get converted but not fully, We could either add an extra transform (imagine outputting some Kotlin code where the alpha gets applied, don't know how that might look). Or (I prefer this), overwrite the built-in
there are 4 colors in the semantic layer that are hard-coded, ideally the color scale should be updated (change the colors in core), but until then we might need to handle this exceptionally (in a custom transform?) (see
this I don't know haha, it depends on how these things are handled in such an environment like Compose, we need to figure it out |
Yup was already trying out something like your second, preferred, suggestion.
this is good to know 🙏
In the jetpack compose starter project there is some light/dark mode configuration apparently, i did not look into it in detail but I think I can get some information on implementation there.
looking here https://github.com/amzn/style-dictionary/blob/main/lib/common/transforms.js i guess font sizes and possibly spacings could also be ported (although not sure if what we have currently would be ok for mobile apps 🤔) |
this generates a .kt file to be used in jetpack compose. There are still a couple of issues, namely:
it seems like colors with an alpha value get not converted, for example:
val TelekomColorUiBorderDisabled = [object Object]
some values do not get converted correctly, for example:
val TelekomColorTextAndIconOnSubtleCyan = #00738A
should be
val TelekomColorTextAndIconOnSubtleCyan = Color(0x00738A00)
some open questions:
design-tokens-all.css
?