- From: Steve Dodier-Lazaro via GitHub <sysbot+gh@w3.org>
- Date: Thu, 04 May 2023 12:34:39 +0000
- To: public-design-tokens-log@w3.org
Having had insightful conversations with @romainmenke (thanks for your persistence ;-) ) and implemented a custom Style Dictionary based token stack, with dark mode, brand themes, locale-specific typography and responsive size tokens for Web, iOS and Android: * I agree with @mkeftz that we need multiple fallbacks, that makes life much easier when formatting the output for platforms that cannot merge their resource files, but only point to a single file at a time where we need each token for each mode / condition to be valued * There are as many good ways to format modes as platforms out there, we've had to * write a single file with custom selectors/conditionals to express modes (Tailwind, iOS Swift) * write entire folder architectures where the platform decides in which order to apply them (Android's baked in support for dark mode and locale specific resources) * write folder architectures with custom platform code to hint in which order to use theme (Android's theme infrastructure) * write individual tokens to a file, with the value for each mode within every file (iOS xcassets) I've started a PoC feature to implement multiple values per token, which could both support Romain's proposal and themes (we use it for both) because it wasn't tractable for us to have the output format for modes/themes/conditional values imposed by tool restrictions, it was too platform-dependant. I would have found it helpful to have predefined conditional values that tools know how to transform (e.g. dark mode to CSS), though I acknowledge we've had to rewrite every transform and format and ended up using almost none of Style Dictionary's built-in code for this complex use case, so I am not 100% sure everyone would agree on how these predefined conditionals should be done. For me, built-in behaviours here would benefit from being overridable though I now agree with Romain they are useful. Regardless, the same/similar format can be used for both themes and conditional values with a defined semantic. Looking back on my Style Dictionary PoC, having both would cost the same to write as having either. See https://github.com/amzn/style-dictionary/issues/909 if you're curious, though be aware I won't be making progress soon on this due to other commitments. -- GitHub Notification of comment by Sidnioulz Please view or discuss this issue at https://github.com/design-tokens/community-group/issues/210#issuecomment-1534700708 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Thursday, 4 May 2023 12:34:41 UTC