check out the demo deploy to heroku
/boop |
/fizz |
/buzz |
/ok/radial |
/yep/linear/160,80 |
Generate a gradient by passing a string (eg. username or email) as a URL path to
your endpoint, for example microgradient.herokuapp.com/shwilliam.
A request for a gradient will, by default, return a 200px
by 200px
SVG.
The path of the request is used to pass a string used to seed the gradient.
Optionally, you can also specify the type of gradient to be generated, as well
as its size. For example, /janedoe/radial/42,42
will return a radial,
42px
by 42px
SVG gradient.
Pass optional URL query parameters to format the requested gradient.
Key | Required | Default | Type | Example |
---|---|---|---|---|
type |
❌ | 'svg' |
'svg' | 'png' | 'jpeg' | 'ico' |
?type=png |
size |
❌ | 200 |
Number (single or comma-separated tuple) |
?size=20 ?size=100,20 |
variant |
❌ | 'linear' |
'linear' | 'radial' |
?variant=radial |
text |
❌ | none | String |
?text=JD |
Generating an ICO version of a gradient works a bit differently. Passing type=ico
returns a page with a download link for the file. Note that the icon created will
always be 14px
by 14px
; passing a size
parameter will not have any effect.
npm i
npm run dev
npm i
npm run build
npm start
docker build --tag gg:1.0 .
docker run -p 1234:1234 -d --name gg gg:1.0
This project leans heavily on the sharp
library for image processing and color
for
color manipulation. Other open-source projects that offer similar solutions to
this one include get-gravatar
and avatar
.
This project is open to and encourages contributions! Feel free to discuss any bug fixes/features in the issues. If you wish to work on this project:
- Fork this project
- Create a branch (
git checkout -b new-branch
) - Commit your changes (
git commit -am 'add new feature'
) - Push to the branch (
git push origin new-branch
) - Submit a pull request!