Faviator
made with
Vuejs
简介及使用教程
Faviator是一个favicon生成器。使用Vue.js开发,简单易用。
安装
CLI 模式:
npm install -g faviator
可编程API模式:
npm install --save-dev faviator
使用
CLI模式:
faviator -h
Usage: faviator [options]
A simple easy favicon generator.
Options:
-V, --version output the version number
-s, --size <n> Width and height of the favicon
-t, --text <value> Text in the favicon
--dx <n> Move text horizontally
--dy <n> Move text vertically
--font-size <n> Font size of the text
-f, --font-family <value> Font family; please choose from Google Fonts
--font-weight <value> Font weight; please choose from Google Fonts
--font-color <value> Color name/hex/rgb
-B, --background-color <value> Background color of favicon
--border-width <n> Width of the border
-b, --border-color <value> Color of the border
-R, --border-radius <n> Short hand to set rx and ry
--rx <n> x-axis border radius
--ry <n> y-axis border radius
-c, --config <path> use a config file to draw
-o, --output <path> If not specified, svg will be printed to stdout. You can use .svg/.jpeg/.jpg/.png extensions.
-h, --help output usage information
可编程API模式:
const config = {
size: 16, // the width and height of the generated image (in px)
text: '',
dx: 0, // move the text from the 'center' horizontally
dy: 0, // move the text from the 'center' vertically
fontSize: 0,
fontFamily: '', // a font from Google Font
fontColor: '',
fontWeight: '', // the weight of the font from Google Font
backgroundColor: '',
borderWidth: 0,
borderColor: '',
borderRadius: 0, // rx and ry will be set to this if defined
rx: 0, // x-axis radius of the favicon
ry: 0, // y-axis radius of the favicon
};
const faviator = require('faviator');
faviator.svg(config)
.then(buffer => buffer.toString())
.then(svg => console.log(svg));
示例
作者
Jason Yu
@ycmjason相关项目