ak-outset

Color context from the layer around the parent layer.

ak-outset makes an element take its color context from the layer around its parent layer. Use it on an element that paints outside its parent’s box, such as a bar below a selected tab. Without it, the element adapts to its parent layer, which is not the surface behind it.

<div class="ak-layer ak-layer-canvas">
  <button class="ak-layer ak-layer-primary relative ak-frame ak-frame-xl/2">
    Selected tab
    <span
      class="ak-layer ak-layer-contrast ak-outset absolute inset-x-0 -bottom-2 h-0.5"
    ></span>
  </button>
</div>

The bar sits on the canvas, so ak-layer-contrast moves it away from the canvas instead of the primary button.

UtilityDescription
ak-outsetReads the layer around the parent layer wherever the utilities on the same element would read the parent layer: ak-layer and its modifiers (including ak-layer-mix and ak-layer-contrast), ak-text, ak-outline, and ak-edge-contrast.

Put ak-outset on a direct child of an ak-layer element. The parent layer keeps the outer layer’s values only when one of its direct children has ak-outset in its class attribute. A variant such as [.ak-layer>&]:ak-outset works, but an ak-outset that only comes from @apply in a class with another name does not. The body element never keeps them, because no layer surrounds it.

The values do not inherit. Descendants of an ak-outset element measure from their own parent layer as usual. Layer appearance variants such as ak-dark also keep matching the parent layer. So does the direction in which ak-layer moves its edge color away from the layer color, so a border on an ak-outset element can have less contrast with the surface behind it. ak-edge-contrast measures against the outer layer but keeps this direction, so it can miss its floor when one of the two layers is light and the other is dark.

To match the appearance of the outer layer on the element itself, use the outset layer appearance variants, such as ak-outset-dark. For example, ak-outset-light:h-[3px] ak-outset-dark:h-[2px] makes a bar thicker on a light surface, also when its parent layer is dark.

When the element paints over its parent instead, such as a bar with a negative offset, leave ak-outset out so it keeps reading the parent layer.