New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

create-logo

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

create-logo - npm Package Compare versions

Comparing version 1.0.1 to 1.0.4

fonts/Montserrat-Bold.ttf

10

dist/cli.js

@@ -58,4 +58,4 @@ "use strict";

text: args['_'][0],
bgColor: args['--bgColor'] || '#FFFFFF',
textColor: args['--textColor'] || '#000000',
bgColor: args['--bgColor'] || '#000',
textColor: args['--textColor'] || '#FFF',
outFile: args['--outFile'],

@@ -76,3 +76,5 @@ png: args['--png'] || false,

return [2 /*return*/, console.error('Text must be specified.')];
svg = _1.createSvg(options);
return [4 /*yield*/, _1.createSvg(options)];
case 1:
svg = _b.sent();
if (!options.outFile)

@@ -84,3 +86,3 @@ return [2 /*return*/, console.log(svg)];

return [4 /*yield*/, _1.createSharpFromSvg(svg)];
case 1: return [2 /*return*/, _a.apply(void 0, [(_b.sent()), options.outFile])];
case 2: return [2 /*return*/, _a.apply(void 0, [(_b.sent()), options.outFile])];
}

@@ -87,0 +89,0 @@ });

2

dist/index.d.ts

@@ -13,3 +13,3 @@ import sharp, { Sharp } from 'sharp';

*/
export declare function createSvg({ bgColor, text, textColor }: SvgOptions): string;
export declare function createSvg({ bgColor, text, textColor }: SvgOptions): Promise<string>;
/**

@@ -16,0 +16,0 @@ * Create a sharp from an svg.

@@ -43,4 +43,6 @@ "use strict";

exports.saveSvgToFile = exports.saveSharpToFile = exports.createSharpFromSvg = exports.createSvg = void 0;
var fs_1 = __importDefault(require("fs"));
var path_1 = __importDefault(require("path"));
var sharp_1 = __importDefault(require("sharp"));
var fs_1 = __importDefault(require("fs"));
var opentype_js_1 = __importDefault(require("opentype.js"));
/**

@@ -54,5 +56,23 @@ * Create an svg with a given color and text.

var bgColor = _a.bgColor, text = _a.text, textColor = _a.textColor;
return "\n<svg viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n <style>\n @import url('https://fonts.googleapis.com/css?family=Montserrat:700');\n </style>\n <rect width=\"100%\" height=\"100%\" rx=\"3\" fill=\"" + bgColor + "\" />\n <text x=\"100%\" y=\"95%\" text-anchor=\"end\" font-family=\"Montserrat\" font-weight=\"700\" fill=\"" + textColor + "\">" + text + "</text>\n</svg>\n";
return __awaiter(this, void 0, void 0, function () {
var font, fontPath;
return __generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, opentype_js_1.default.load(path_1.default.join(__dirname, '../', 'fonts', 'Montserrat-Bold.ttf'))];
case 1:
font = _b.sent();
fontPath = font.getPath(text, 4, 22, 14);
fontPath.fill = textColor;
return [2 /*return*/, [
"<svg viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">",
"<rect width=\"100%\" height=\"100%\" rx=\"3\" fill=\"" + bgColor + "\" />",
fontPath.toSVG(2),
'</svg>',
].join('')];
}
});
});
}
exports.createSvg = createSvg;
;
/**

@@ -59,0 +79,0 @@ * Create a sharp from an svg.

{
"name": "create-logo",
"version": "1.0.1",
"version": "1.0.4",
"description": "Create a simple svg logo with text over a background.",

@@ -10,7 +10,10 @@ "main": "./dist/index.js",

},
"files": ["dist", "bin"],
"files": [
"dist",
"bin",
"fonts"
],
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "tsc",
"start": "npm run build && node dist/index.js",
"prepublish": "npm run build"

@@ -36,5 +39,7 @@ },

"arg": "^5.0.0",
"opentype.js": "^1.3.3",
"sharp": "^0.27.2"
},
"devDependencies": {
"@types/opentype.js": "^1.3.1",
"@types/sharp": "^0.27.1",

@@ -41,0 +46,0 @@ "typescript": "^4.2.3"

<h1>
<img src="./cl.svg" alt="Avatar" width="50" height="50">
<img src="cl.svg" alt="create-logo Logo" width="50" height="50">
create-logo

@@ -16,8 +16,9 @@ </h1>

Example: `create-logo CL --bgColor "#FFFF00" --textColor "#000000" --outFile "cl.svg"`
SVG Example: `create-logo CL --bgColor "#FFFF00" --textColor "#000000" --outFile "cl.svg"`
PNG Example: `create-logo CL --bgColor "#FFFF00" --textColor "#000000" --outFile "cl.png" --png`
### Arguments
* --bgColor: Set the background color of the logo.
* --textColor: Set the color of the text in the logo. Default is `#FFFFFF`.
* --bgColor: Set the background color of the logo. Default is `#000` (black).
* --textColor: Set the color of the text in the logo. Default is `#FFF` (white).
* --outFile: The file to put the svg or, if specified, the png in.
* --png: Specify if you want to create a png logo (default is svg).
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc