Function

@pn, @pnr

Pick the arguments in order, one per cell, starting over at the end. @pnr goes backwards.

Syntax

  • @pn(<value>, ...)
  • @pn([<range>])
  • @pnr(<value>, ...)

Each call site keeps its own counter, advanced once per cell, or once per step inside a @m sequence. Ranges expand as for @p. @pl, @pr and @pick-n are older names.

The uppercase @PN, @PNR read the enclosing sequence step instead.

Examples

@grid: 5 / 60vmin _1px;
background: @pn(#000, #e6437d, #ebbf4d, #fff);
@grid: 5 / 60vmin _1px;
background: #000;
color: #fff;
@content: @pn([1-9]);

Forward and backward in the same grid:

@grid: 6 / 60vmin _1px;
background: #000;
@cell(y % 2 = 1) {
  opacity: @pn(.2, .4, .6, .8, 1);
}
@cell(y % 2 = 0) {
  opacity: @pnr(.2, .4, .6, .8, 1);
}

Inside a sequence, one value per step:

@grid: 1 / 60vmin;
background: linear-gradient(
  45deg,
  @m4(@pn(#000, #e6437d, #ebbf4d, #fff) 0 @n(*25%))
);

See also