- From: Joe Strouth via GitHub <sysbot+gh@w3.org>
- Date: Thu, 30 Jan 2020 21:33:32 +0000
- To: public-design-tokens-log@w3.org
There are some things the format could specify to help make implementing functions and other tooling easier. Particularly with types, although much of the discussion in this thread centers around distinguishing _token types_ (categories) like color vs font size. What about typed values? I mostly see value represented as a string, with both the value and the unit/format combined like `'1rem'`. This is true for colors as well, like `'#000000'` or `'rgb(a,b,c)'`. Wouldn't it be helpful to instead store unit/format separately? Particularly for more complex token types like color or elevation. ```ts const red: RGBToken = { name: 'red-100', value: { red: 255, blue: 0, green: 0 }, format: ColorFormat.RGB } const redHex: HexToken = { name: 'red-200', value: '#FF0000', format: ColorFormat.Hex } ``` ```ts interface FontSizeToken { name: string value: number unit: FontSizeUnit } const baseFontSize: FontSizeToken = { name: 'font-size-base', value: 16, unit: FontSizeUnit.Pixels } ``` [Color Playground](https://www.typescriptlang.org/play/index.html#code/C4TwDgpgBASg4gIQGoEMA2BXaBeKBvAKCmKgCcIATALigDsMBbAIwlKJIHNyJab7nW7Yk0wQ+jFmwC+BUJCgAJCAA9UoqLgDOwUgEtaHWeGgBhAPZozpNVg2xEN6AB9FKxwR6Mo5y6QBiVgwowPhC9gh2AOSkHEyRADRhSspRABYqkQQyBPrArABmKADGphZWACpmANY8oSR0KAxiUNp6BmEAbuhYND5W7vX5gcG9Zf7DwFk5tHmkhSXhlTW0UCp5tBSa3mNLtYT1XaI08MjdEGFDpEHAo74BV8EAdCdTuQXF0Mm7K2s8m9u+b51EiHHquVRnC4TW5We7XR7JKYEIpmWjaMiUY6IIG4fYkWiNZrRSgAWgAjAAGCkJTpnGh4+rEcjUKAAJgArOzEoySCIwRTuTyoFwIDwaBSwlJBcRLtcYeMHsBnogkSi0SFmckaF9qrVcWECU0aMSKCTWVSaQc6VBIgBiPx+KkW6VQWUjAGwiYIlRZIA) | [Font Playground](https://www.typescriptlang.org/play/index.html?ssl=20&ssc=2&pln=72&pc=2#code/JYOwLgpgTgZghgYwgAgGIHtwGVgC8IAq6A1hCMgN4BQytyIcAthAFzIDOYUoA5jXQDc4AGwCureqMYAjaP1qiQwMGwzY8EAKpKwyAPR7k6KBy68qAXypkpaTGBz5tyyvOQAFYAA8Iw9sgBeZAByAAcvYIAaN3d0UDB-ILCwKLcAJQhGRJCoTNS6ZAARCAFgJABJEAATCFCyGvBPHz9AkKrQ-LosBBEISpq66rIwJt9s4PYO6ILKhAALCHHQTtoAWWBhYWBmSChxxkZgyyoqBExOZGk4dgg1Bw1Ve0dCEjJW6gKGZjZgmHsAWnYGn+VxuK2QQjEEgAjAA2aZ0RTKR7qJw6AB0oz8liAA) This way for any token in a particular category, a tool could check one field and know how to ingest or transform its value. `format` could be used to signify that `value` holds a reference to another token, a description of a function call, etc. -- GitHub Notification of comment by joestrouth1 Please view or discuss this issue at https://github.com/design-tokens/community-group/issues/1#issuecomment-580470263 using your GitHub account
Received on Thursday, 30 January 2020 21:33:33 UTC