Skip to main content
The Deno 2 Release Candidate is here
Learn more

PostCSS Solid-Color Image PostCSS

This PostCSS plugin lets you use a solid color as an image, following the CSS Images specification.

.box {
  background: image(red);
}

/* becomes */

.box {
  background: linear-gradient(red, red);
}

Usage

Deno

Import the module from deno.land/x:

import postcss from "https://deno.land/x/postcss@8.3.10/mod.js";
import colorImage from "https://deno.land/x/postcss_color_image@3.1.0/mod.js";

await postcss([colorImage]).process(YOUR_CSS);

Node.js

Install the npm package:

npm install postcss-color-image

Then import or require it:

import postcss from "postcss";
import colorImage from "postcss-color-image";
// OR
const postcss = require("postcss");
const colorImage = require("postcss-color-image");

await postcss([colorImage]).process(YOUR_CSS);