Checks for tools: cssints/check

The 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"] ```
@see{@link runPromiseExit} for a version that returns an `Exit` type instead of rejecting.@categoryrunning@since2.0.0
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 it