Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/olizilla/swatches

◼ color swatches for your README as a service.
https://github.com/olizilla/swatches

Last synced: 9 days ago
JSON representation

◼ color swatches for your README as a service.

Awesome Lists containing this project

README

        

# SWATCHES

You want to put color swatches in your github README, but it won't render html style attributes, and you can't be bothered to make or host the pngs. What if you could just...

`![A lovely hotpink color swatch](https://swatch.now.sh/?color=hotpink)`

and have it render as:

![A lovely hotpink color swatch](https://swatch.now.sh/?color=hotpink)

**why yes! SVG color swatches as a supernice service** thanks to the wonders of [now.sh](https://now.sh)

```md
![Charcoal](https://swatch.now.sh/?color=%2324364C)
![Royal blue](https://swatch.now.sh/?color=%232B60D5)
![Ultramarine blue](https://swatch.now.sh/?color=%23437AF4)
![Bleu de France](https://swatch.now.sh/?color=%234299FF)
```

![Charcoal](https://swatch.now.sh/?color=%2324364C)
![Royal blue](https://swatch.now.sh/?color=%232B60D5)
![Ultramarine blue](https://swatch.now.sh/?color=%23437AF4)
![Bleu de France](https://swatch.now.sh/?color=%234299FF)

Add your `color` at the end of the url, get back an svg square.

https://swatch.now.sh/?color=hotpink

For hex codes you have to url encode the `#` with `%23`.

https://swatch.now.sh/?color=%234299FF

For hsl() you have to encode the `%` with `%25`

https://swatch.now.sh/?color=hsl(52,100%25,20%25)

rbg(), and css color names are fine.

![](https://swatch.now.sh/?color=rgb(255,220,0))
![](https://swatch.now.sh/?color=goldenrod)
![](https://swatch.now.sh/?color=chartreuse)

## Options

`color` - an rgb or hsl or css color name. Default: `hotpink`
`name` - an optional label for your color. Default: the value of `color`

## Development

Install `vercel` and run

```shell
vercel dev
```

## Deployment

Pushes to the default branch are deployed.

---

A [(╯°□°)╯︵TABLEFLIP](https://tableflip.io) side project.