Next: , Previous: , Up: API  


1.18 (olive-css dsl)

1.18.1 Macros

Macro: declaration-property x

Undocumented macro.

Macro: declaration-value x

Undocumented macro.

Macro: declaration? x

Undocumented macro.

Macro: make-declaration x

Undocumented macro.

Macro: make-rule x

Undocumented macro.

Macro: rule-declarations x

Undocumented macro.

Macro: rule-selector x

Undocumented macro.

Macro: rule? x

Undocumented macro.

Macro: set-rule-selector! x

Undocumented macro.

1.18.2 Procedures

Procedure: add-dark-wrapper args

Prefix every utility rule in args with dark-selector-prefix.

This produces fully flat, data-theme=dark-scoped selectors (no nested rules), which is maximally compatible. The generator instead groups the rules under a single dark-selector-prefix scope to avoid repeating the scope selector on every rule, which keeps the large dark color section compact.

Procedure: add-hover-variant sel args

Transform utility rules in args into flat :hover interactive selectors prefixed by sel.

Procedure: add-media-query-prefix sel args

Prefix utility class selectors within args to incorporate a specific media query screen size token sel.

Procedure: add-state-variant sel pseudo args

Transform utility rules in args into flat interactive selectors.

Rather than emitting CSS nesting (.x{&:hover{...}}), this produces the fully expanded selector (.x:hover{...}). The result is plain CSS 3 (no top-level nesting dependency) and a few bytes smaller per rule, which matters because state variants are generated for every color and utility.

Procedure: css-color-rules selector KEY: #:property #:variants #:other-properties #:palettes

Construct color-specific utility rules mapping across specified palettes, configurations, and opacity variants.

Procedure: css-comment msg

Format a given string message msg inside a CSS multi-line block comment wrapper.

Procedure: css-declaration property value

Undocumented procedure.

Procedure: css-palette-rules selector KEY: #:property #:palettes #:other-properties

Generate one solid (alpha = 1) rule per palette shade.

Unlike css-color-rules this does not expand the alpha cross-product, which keeps derived color families (ring, outline, fill, stroke, accent, caret) affordable. selector is a format template with two arguments: the palette name and the shade weight, e.g. ".ring-~a-~a".

Procedure: css-rule selector . args

Construct a new CSS rule object containing a target selector and flattened args declarations.

Procedure: css-rule-variants selector KEY: #:property #:variants #:other-properties

Generate a list of CSS rules from a template selector across multiple string value variants.

Procedure: css-size s KEY: #:conversion #:multiplier

Process a sizing pair s by modifying numeric values via a multiplier and formatting output with conversion.

Procedure: darken-oklch xs n

Darken an OKLCH color by subtracting value n from its lightness component. xs is a list representing OKLCH color components where the car is lightness.

Procedure: flatten-list xs

Recursively flatten a deeply nested list xs into a single flat list.

(flatten-list '(1 (2 3) 4)) ⇒ '(1 2 3 4)
Procedure: format-css xs

Recursively transform an arbitrarily structured hierarchy of rule records, lists, or declarations xs into valid CSS text format strings.

Procedure: identity-oklch oklch some

Return the original oklch components completely unmodified, ignoring some.

Procedure: lighten-oklch xs n

Lighten an OKLCH color by adding value n to its lightness component. xs is a list representing OKLCH color components where the car is lightness.

Procedure: list-combinations list1 list2

Compute all combinations (Cartesian product) of elements present between list1 and list2.

Procedure: make-palette oklch KEY: #:transformers

Generate a tiered color palette mapping variant weights (e.g., 100, 500, 900) to transformed variations of a base oklch configuration.

Procedure: media-query query . args

Wrap an evaluated set of stylesheet components inside a CSS modern media query expression container block.

(media-query "min-width: 768px" ".container { display: block; }")
Procedure: minify-css css

Collapse a formatted CSS string css into a compact, minified form.

Only whitespace that is never significant is removed: runs of whitespace are collapsed to a single space, the space after declaration separators is dropped, and braces are tightened. Descendant combinators and quoted strings (font stacks, oklch components) are preserved.

Procedure: to-percent x

Convert a decimal numeric ratio or number x into a standard CSS percentage % string token.

Procedure: to-percent-function f

Return a higher-order closure function transforming numbers into CSS functional notations f scaling values in percentage terms.

Procedure: to-px x

Convert a primitive numeric measurement value x into a standard CSS px string value.

Procedure: to-rem x

Convert a primitive numeric measurement value x into a standard CSS rem string value.

Procedure: to-rem-blur x

Wrap a native numeric measurement value x within a valid CSS standard blur(...) layout definition.

Procedure: ~ KEY: #:output-port . args

Format a string with arguments. This is a descriptive alias for format with an optional destination port.

(~ "color: ~a;" "red") ⇒ "color: red;"

1.18.3 Record Types

Record type: declaration

This record type has the following fields:

  • property
  • value
Record type: rule

This record type has the following fields:

  • selector
  • declarations

1.18.4 Variables

Variable: dark-selector-prefix
":where([data-theme=dark], [data-theme=dark] *)"
Variable: where-dark
"&:where([data-theme=dark], [data-theme=dark] *)"

Next: (olive-css license), Previous: (olive-css decl typography), Up: API