cssints/checkThe engine's own checks, as functions, for a tool that answers as a build would (@cssints/mcp). Node only (culori, LightningCSS): nothing here reaches a browser, and user code has no reason to import it. Each returns an Effect.
import { const contrast: (foreground: string, background: string) => Effect.Effect<{
ratio: number;
text: string;
}, ContrastError, never>
The WCAG 2.x contrast ratio of two CSS colours, as `css.check.contrast` computes it: culori reads the colour, one
outside sRGB is clipped to it, a translucent one has no contrast. `text` is the ratio cut (not rounded) at two places,
as the check's message prints it.contrast } from "cssints/check";
import { import EffectEffect } from "effect";
const { const ratio: numberratio, const text: stringtext } = await import EffectEffect.const runPromise: <{
ratio: number;
text: string;
}, ContrastError>(effect: Effect.Effect<{
ratio: number;
text: string;
}, ContrastError, never>, options?: Effect.RunOptions | undefined) => Promise<{
ratio: number;
text: string;
}>
Executes an effect and returns the result as a `Promise`.
**When to use**
Use when you need to execute an effect and work with the
result using `Promise` syntax, typically for compatibility with other
promise-based code.
If the effect succeeds, the promise will resolve with the result. If the
effect fails, the promise will reject with an error.
**Example** (Running a successful effect as a Promise)
```ts import.meta.vitest
import { Effect } from "effect"
await Effect.runPromise(Effect.succeed(1)) // => 1
```
**Example** (Running effects as promises)
```ts import.meta.vitest
//Example: Handling a Failing Effect as a Rejected Promise
import { Effect } from "effect"
const output: Array<unknown> = []
await Effect.runPromise(Effect.fail("my error")).catch(() => {
void output.push("rejected")
})
output // => ["rejected"]
```runPromise(function contrast(foreground: string, background: string): Effect.Effect<{
ratio: number;
text: string;
}, ContrastError, never>
The WCAG 2.x contrast ratio of two CSS colours, as `css.check.contrast` computes it: culori reads the colour, one
outside sRGB is clipped to it, a translucent one has no contrast. `text` is the ratio cut (not rounded) at two places,
as the check's message prints it.contrast("#777", "white"));
// ratio 4.478…, text "4.47": cut, not rounded, as the message of css.check.contrast prints itcontrast(foreground, background) is the WCAG 2.x ratio of css.check.contrast (see Themes): culori reads the colour, one outside sRGB is clipped to it. A colour it cannot read (currentColor, a var()) or a translucent one fails with a ContrastError (colour, message).loweredOf(property, value, warning) answers what a build asks before it says a support warning ("No warning for what LightningCSS lowers", under Errors): the value of the first declaration LightningCSS writes for the targets of the warning, or undefined when it leaves the feature in place (text-wrap, a var() inside the value). warning is one of support() of @cssints/css-grammar/support; a custom property is --name. For color: oklch(70% 0.2 330) and chrome 100 it is a hex colour, so a build does not warn.