Skip to content

design-token/opacity

Summary

Enforces opacity values to match the opacity tokens defined in your configuration.

Configuration

Enable the rule in designlint.config.*. See configuration for defining tokens.

json
{
  "tokens": {
    "$version": "1.0.0",
    "opacity": {
      "low": { "$type": "number", "$value": 0.2 },
      "high": { "$type": "number", "$ref": "#/opacity/low" }
    }
  },
  "rules": { "design-token/opacity": "error" }
}

Options

No additional options.

This rule is not auto-fixable.

Examples

Invalid

css
.box { opacity: 0.5; }

Valid

css
.box { opacity: 0.2; }

When Not To Use

If opacity values are not standardized, disable this rule.

See also

Released under the MIT License.