# dls-color-palette

> Color palette generator for Baidu Light DLS.

Latest version **0.1.1** (published 2023-04-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install dls-color-palette
pnpm add dls-color-palette
yarn add dls-color-palette
bun add dls-color-palette
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2023-04-20 |
| First published | 2020-09-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 82.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 25 |
| Maintainers | mahaina, ecomfe-core |
| Keywords | color, palette, dls, baidu |

## Links

- npm: https://www.npmjs.com/package/dls-color-palette
- Repository: https://github.com/ecomfe/light-dls
- Homepage: https://github.com/ecomfe/light-dls#readme
- Issues: https://github.com/ecomfe/light-dls/issues
- npm.io page: https://npm.io/package/dls-color-palette

## Dependencies (1)

- [color-converters](https://npm.io/package/color-converters.md) ^0.1.1

## Alternatives

- [postcss-color-hex-alpha](https://npm.io/package/postcss-color-hex-alpha.md) — 6.4M weekly downloads
- [randomcolor](https://npm.io/package/randomcolor.md) — 348.0K weekly downloads
- [bows](https://npm.io/package/bows.md) — 1.3K weekly downloads
- [ep_prefer_color_scheme](https://npm.io/package/ep_prefer_color_scheme.md) — 260 weekly downloads
- [coc-yank](https://npm.io/package/coc-yank.md) — 61 weekly downloads

## Recent versions

- 0.1.1 (latest) — 2023-04-20
- 0.1.0 — 2022-09-27
- 0.0.1-alpha.3 — 2020-09-16
- 0.0.1-alpha.2 — 2020-09-11
- 0.0.1-alpha.1 — 2020-09-09
- 0.0.1-alpha.0 — 2020-09-07

## README

# dls-color-palette

To generate a color palette out of the given base color.

## Installation

```sh
npm i --save-dev dls-color-palette
```

## Usage

### Get color shade

`function getShade(color: string, level: number): string`

**Params**:

- `color: string` - the brand color in hex format.
- `level: number` - level of the color shade. Valid range: [1, 10]

**Return Value**:

- Color of the given level in hex format.

```js
import { getShade } from 'dls-color-palette'
const shade = getShade('#0052cc', 2) // → #e0edff
```

### Get contextual color according to the given brand color

`function getContextual(color: string, type: string): string`

**Params**:

- `color: string` - the brand color in hex format.
- `type: 'info' | 'success' | 'warning' | 'error'` - type of the contextual color.

**Return Value**:

- Contextual color in hex format.

```js
import { getContextual } from 'dls-color-palette'
const contextual = getContextual('#0052cc', 'success') // → #00bf5c
```

---
_Source: https://npm.io/package/dls-color-palette · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
