Appearance
One Rectangle to rule them all
The goal of al this has been to create a more efficient and unified way of describing the appearance of a rectangle.
There is no 'correct' answer as to how to do this. One implementation in CSS could look like this:
css
.one-rectangle {
border: var(--container-border-width) solid var(--container-border);
background-color: var(--container-background-colour);
color: var(--container-colour);
padding-inline: calc(
var(--container-padding-inline) - var(--container-border-width)
);
padding-block: calc(
var(--container-padding-block) - var(--container-border-width)
);
gap: var(--container-gap);
border-radius: max(
calc(
var(--container-border-radius-fixed) +
(
var(--container-border-radius-sharpness) *
var(--container-padding-block)
)
),
var(--container-border-radius-minimum)
);
}Although this has limitations on how the :hover, :active or :disabled (or [aria-disabled="true"]) selectors are targeted. You will have to experiment to find the ideal implementation within your own design system.
The important point is not just that we can use this class in combination with all our other mode utilities to define our rectangle:
html
<div
class="
one-rectangle
appearance-sentiment
sentiment-positive
size-small
typography-medium
"
></div>But that this matches exactly the way the designs are implemented:
Appearance
Appearance
Sentiment
Sentiment
Positive
Size
Small
Typography
Medium