Re: [community-group] Shadow type feedback (#100)

Just been catching up on all this great feedback. Thanks y'all!

First off, I completely agree that `shadow` tokens should be able to have values that are an array (as suggested by @drwpow & @lukasoppermann) so that they can express layered shadows. My only question there is should the structure of a `shadow` `$value` always be an array (which could just contain a single element) or should it be object (as currently specced) _or_ an array? I don't have strong feelings either way.

As for the `inset` stuff, I agree there should be a way to express that. However, I wonder if there's value in also retaining something like the current syntax for the purpose of defining "generic" shadows that are intended to be used both as inset and outset shadows.

In that case one might argue that decision of _how_ a shadow should be applied is separate form the definition of the shadow itself. So perhaps there needs to be an additional token type (`shadowStyle` perhaps?) for tokens that express a shadow _and_ how it should be applied.

For example:

```jsonc
{
  "elevation-1": {
    "$type": "shadowStyle",
    "$value": {
      "shadow": {
        // this sub-value is either a shadow value or reference to a shadow token
        "color": "00000080",
        "offsetX": "0rem",
        "offsetY": "0.5rem",
        "blur": "1rem",
        "spread": "0rem"
      },
      "inset": false
    }
  },

  // example using a reference for the shadow
  "cut-out": {
    "$type": "shadowStyle",
    "$value": {
      "shadow": "{shadow-1}",
      "inset": true
    }
  },

  // a generic shadow (as per the current draft spec)
  "shadow-1": {
    "$type": "shadow",
    "$value": {
      "color": "12121240",
      "offsetX": "0rem",
      "offsetY": "0.5rem",
      "blur": "1rem",
      "spread": "0rem"
    }
  }
}
```

What do you think? Useful or overengineered/confusing? 😅


-- 
GitHub Notification of comment by c1rrus
Please view or discuss this issue at https://github.com/design-tokens/community-group/issues/100#issuecomment-1333407209 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 1 December 2022 08:42:53 UTC