open-index/open-npm huggingface dataset:
npm package: @11ty/image-color
Description: Small utility to efficiently fetch the colors from an image.
Author: Zach Leatherman
Latest version: 1.0.8

# `@11ty/image-color`

A small utility to efficiently extract color information from images (with a memoization and a disk-cache). Requires Node 18 or newer.

## Installation

Install from [npm: `@11ty/image-color`](https://www.npmjs.com/package/@11ty/image-color):

```sh
npm install @11ty/image-color
```

Based on the great work of [`get-pixels`](https://www.npmjs.com/package/get-pixels/) (via the [`@zachleat/get-pixels` fork](https://github.com/zachleat/get-pixels)) and [`extract-colors`](https://www.npmjs.com/package/extract-colors).

## Usage

```js
import { getImageColors } from "@11ty/image-color";

// Returns an array of color objects
let colors = await getImageColors("./sample.jpg");

// Works with local or remote images
// let colors = await getImageColors("https://example.com/sample.jpg");

// Get oklch string values
colors.map(c => c.background);

// Get hex values
colors.map(c => c.colorjs.toString({format: "hex"}));

// Filter colors based on Lightness value
colors.filter(c => c.colorjs.oklch.l > .1);

// Sort Lightest colors first
colors.sort((a, b) => {
	return b.colorjs.oklch.l - a.colorjs.oklch.l;
})
```

Learn more about [color.js Color objects](https://colorjs.io/docs/the-color-object).

### Returns

An array of colors in the image, with the following properties:

```js
[{
	background, // oklch color string (you probably want this)
	foreground, // accessible color for text on top

	colorjs, // colorjs.io Color object

	mode, // one of "dark" or "light", based on WCAG21 contrast versus #000 or #fff
	contrast: {
		light, // WCAG21 contrast color (number) versus white (#fff) (4.5+ is good)
		dark, // WCAG21 contrast color (number) versus black (#000) (4.5+ is good)
	},

	toString(), // returns same as `background`
}]
```

Learn more about [color.js Color objects](https://colorjs.io/docs/the-color-object).
npm package: @11ty/package-bundler
Description: Internal package to build bundles (using esbuild) for use in various environments
Author: Zach Leatherman
Latest version: 0.5.5

# @11ty/package-bundler

Internal package to build Eleventy core and plugin bundles (using esbuild, with support for adapters) for use in various environments (client).

## Usage

Available on [npm as `@11ty/package-bundler`](https://www.npmjs.com/package/@11ty/package-bundler):

```
npm install @11ty/package-bundler
```

```js
import bundle from "@11ty/package-bundler";

await bundle(INPUT, OUTPUT, {
  name: "Eleventy Fetch",
  fileSystemMode: "consume",
  external: [
    "fs",
    "node:fs",
    "node:crypto",
  ],
  moduleRoot: ".", // root directory to resolve node_modules paths
  esbuild: {}, // options passed to esbuild
});
```

### Sample

```js
import pkg from "../package.json" with { type: "json" };
import bundle from "@11ty/package-bundler";

await bundle(import.meta.resolve("@11ty/eleventy-fetch"), `demo/lib/eleventy-fetch.js`, {
  name: "Eleventy Fetch",
});
await bundle(import.meta.resolve("@11ty/eleventy-plugin-syntaxhighlight"), `demo/lib/eleventy-plugin-syntaxhighlight.js`, {
  name: "Eleventy Syntax Highlighter",
});
await bundle(import.meta.resolve("@11ty/eleventy-navigation"), `demo/lib/eleventy-navigation.js`, {
  name: "Eleventy Navigation",
});
await bundle(import.meta.resolve("@11ty/eleventy-plugin-rss"), `demo/lib/eleventy-plugin-rss.js`, {
  name: "Eleventy RSS",
});
await bundle(import.meta.resolve("@11ty/eleventy-img"), `demo/lib/eleventy-img.js`, {
  name: "Eleventy Image",
});
```
npm package: @11ty/posthtml-urls
Description: PostHTML plugin for transforming URLs. A fork of posthtml/posthtml-urls.
Author: Zach Leatherman
Latest version: 1.0.3

# `@11ty/posthtml-urls`

PostHTML plugin for transforming URLs. This is a fork of [`posthtml/posthtml-urls`](https://github.com/posthtml/posthtml-urls).


## Installation

[Node.js](http://nodejs.org) `>= 6` is required. To install, type this at the command line:

```shell
npm install @11ty/posthtml-urls
```


## Usage

```js
const posthtml = require('posthtml');
const urls = require('@11ty/posthtml-urls');

const options = {
  eachURL: (url, attr, tagName, rawNode) => `http://domain.com/${url}`
};

posthtml()
  .use( urls(options) )
  .process('<a href="link.html">link</a>')
  .then(result => console.log(result.html));
//-> <a href="http://domain.com/link.html">link</a>
```


## Options

### `eachURL`
Type: `Function`
Default value: `undefined`
A callback function ran for each URL value found. You can return either a synchronous value or a `Promise`. The `rawNode` argument was added in `v1.0.3`.

### `filter`
Type: `Object`
Default value: [`{…}`](https://github.com/posthtml/posthtml-urls/blob/master/lib/defaultOptions.js)
The elements and attributes for which to search. An attribute value can optionally be a function, for deeper filtering.


## FAQ
1. **How can I filter `<style>` elements and `style` attributes?**
Use [posthtml-postcss](https://npmjs.com/posthtml-postcss) and [postcss-url](https://npmjs.com/postcss-url).