Gathering detailed insights and metrics for ngx-qrcode-styling-his
Gathering detailed insights and metrics for ngx-qrcode-styling-his
Gathering detailed insights and metrics for ngx-qrcode-styling-his
Gathering detailed insights and metrics for ngx-qrcode-styling-his
This library is built for the purpose generating QR codes with a logo and styling.
npm install ngx-qrcode-styling-his
Typescript
Module System
Node Version
NPM Version
71.9
Supply Chain
96.7
Quality
75.1
Maintenance
100
Vulnerability
99.3
License
HTML (97.82%)
TypeScript (1.95%)
SCSS (0.23%)
Total Downloads
996
Last Day
1
Last Week
2
Last Month
26
Last Year
517
24 Stars
7 Commits
9 Forks
2 Watchers
4 Branches
1 Contributors
Updated on Mar 14, 2025
Minified
Minified + Gzipped
Latest Version
1.4.0
Package Id
ngx-qrcode-styling-his@1.4.0
Unpacked Size
396.07 kB
Size
66.30 kB
File Count
22
NPM Version
8.11.0
Node Version
16.16.0
Published on
May 22, 2023
Cumulative downloads
Total Downloads
Last Day
0%
1
Compared to previous day
Last Week
-60%
2
Compared to previous week
Last Month
-10.3%
26
Compared to previous month
Last Year
7.9%
517
Compared to previous year
2
2
This library is built for the purpose generating QR codes with a logo and styling.
Demo on the Stackblitz or Codesandbox
Generating styled QRcodes Online
Install ngx-qrcode-styling
from npm
:
1npm install ngx-qrcode-styling --save
Add wanted package to NgModule imports:
1import { NgxQrcodeStylingModule } from 'ngx-qrcode-styling'; 2 3@NgModule({ 4 imports: [ 5 NgxQrcodeStylingModule 6 ] 7})
Add component to your page:
1import { Options } from 'ngx-qrcode-styling'; 2 3export class AppComponent { 4 public config: Options = { 5 width: 300, 6 height: 300, 7 data: "https://www.facebook.com/", 8 image: "https://upload.wikimedia.org/wikipedia/commons/5/51/Facebook_f_logo_%282019%29.svg", 9 margin: 5, 10 dotsOptions: { 11 color: "#1977f3", 12 type: "dots" 13 }, 14 backgroundOptions: { 15 color: "#ffffff", 16 }, 17 imageOptions: { 18 crossOrigin: "anonymous", 19 margin: 0 20 } 21 }; 22}
1<ngx-qrcode-styling [config]="config"></ngx-qrcode-styling>
1<ngx-qrcode-styling 2 #qrcode 3 [config]="config" 4 [type]="'canvas'" 5 [shape]="'square'" 6 [width]="200" 7 [height]="200" 8 [margin]="5" 9 [data]="'Angular QRCode'" 10 [image]="'https://upload.wikimedia.org/wikipedia/commons/5/51/Facebook_f_logo_%282019%29.svg'"> 11</ngx-qrcode-styling>
1import { NgxQrcodeStylingComponent, Options } from 'ngx-qrcode-styling'; 2 3export class AppComponent { 4 @ViewChild('qrcode', { static: false }) public qrcode!: NgxQrcodeStylingComponent; 5 6 onUpdate(): void { 7 this.qrcode.update(this.qrcode.config, { 8 // height: 300, 9 // width: 300, 10 frameOptions: { 11 height: 600, 12 width: 600, 13 }, 14 ... 15 }).subscribe((res) => { 16 // TO DO something! 17 }); 18 } 19 20 onDownload(): void { 21 this.qrcode.download("file-name.png").subscribe((res) => { 22 // TO DO something! 23 }); 24 } 25}
1<div #canvas></div>
1import { NgxQrcodeStylingService, Options } from 'ngx-qrcode-styling'; 2 3export class AppComponent implements AfterViewInit { 4 @ViewChild("canvas", { static: false }) canvas: ElementRef; 5 public config: Options = {...}; 6 7 constructor(private qrcode: NgxQrcodeStylingService) {} 8 9 ngAfterViewInit(): void { 10 // Create QRCode by Service and ElementRef 11 this.qrcode.create(this.config, this.canvas.nativeElement).subscribe((res) => { 12 // TO DO something! 13 }); 14 } 15}
1<div id="canvas"></div>
1import { NgxQrcodeStylingService, Options } from 'ngx-qrcode-styling'; 2 3export class AppComponent implements AfterViewInit { 4 public config: Options = {...}; 5 6 constructor(private qrcode: NgxQrcodeStylingService) {} 7 8 ngAfterViewInit(): void { 9 // Create QRCode by Service and HTMLElement 10 this.qrcode.create(this.config, document.getElementById('canvas')).subscribe((res) => { 11 // TO DO something! 12 }); 13 } 14}
1import { Options } from 'ngx-qrcode-styling'; 2 3export class AppComponent { 4 public config: Options = { 5 template: 'bitcoin', 6 ... 7 } 8}
Or
1<ngx-qrcode-styling [template]="'bitcoin'" [data]="'ngx-qrcode-styling'"></ngx-qrcode-styling>
1import { Options } from 'ngx-qrcode-styling'; 2 3export class AppComponent { 4 public config: Options = { 5 frameOptions: { 6 style: 'F_036', 7 width: 300, 8 height: 300, 9 x: 50, 10 y: 50 11 } 12 ... 13 } 14}
Or
1<ngx-qrcode-styling 2 [template]="'bitcoin'" 3 [data]="'ngx-qrcode-styling'" 4 [width]="280" 5 [height]="280" 6 [image]="'https://upload.wikimedia.org/wikipedia/commons/thumb/9/9a/BTC_Logo.svg/60px-BTC_Logo.svg.png'" 7 [frameOptions]="{style: 'F_036', height: 300, width: 300, x: 60, y: 60}"> 8</ngx-qrcode-styling>
Property | Type | Default Value | Description |
---|---|---|---|
(type) | canvas , svg | canvas | The type of the element that will be rendered |
(shape) | square , circle | square | The type of the element that will be rendered |
(width) | number | 300 | Size of canvas |
(height) | number | 300 | Size of canvas |
(margin) | number | 0 | Margin around canvas |
(data) | string | The date will be encoded to the QR code | |
(image) | string | The image will be copied to the center of the QR code | |
(scale) | number | 0 | Scale qrcode |
(rotate) | number | 0 | Rotate qrcode |
(template) | default , ocean , sunflower , luxury , bitcoin , starbucks , angular , facebook , beans , green , sky , mosaic , coffee , vintage , stamp , chess , jungle , arabic , tea , grape | default | The design of the element that will be rendered |
(frameOptions) | object | Options will be passed to qrcode-generator lib | |
(qrOptions) | object | Options will be passed to qrcode-generator lib | |
(imageOptions) | object | Specific image options, details see below | |
(dotsOptions) | object | Dots styling options | |
(cornersSquareOptions) | object | Square in the corners styling options | |
(backgroundOptions) | object | QR background styling options |
Field | Description | Type | Default |
---|---|---|---|
(create) | status | AsyncSubject | - |
(update) | status | AsyncSubject | - |
(download) | status | AsyncSubject | - |
1export declare type Options = { 2 type?: DrawType; 3 shape?: ShapeType; 4 width?: number; 5 height?: number; 6 margin?: number; 7 data?: string; 8 image?: string; 9 scale?: number; 10 rotate?: number; 11 template?: string; 12 frameOptions?: { 13 style?: string; 14 height?: number; 15 width?: number; 16 x?: number; 17 y?: number; 18 texts?: UnknownObject[]; // SVG Attribute reference 19 contents?: UnknownObject[]; // SVG Attribute reference 20 containers?: UnknownObject[]; // SVG Attribute reference 21 }; 22 qrOptions?: { 23 typeNumber?: TypeNumber; 24 mode?: Mode; 25 errorCorrectionLevel?: ErrorCorrectionLevel; 26 }; 27 imageOptions?: { 28 hideBackgroundDots?: boolean; 29 imageSize?: number; 30 crossOrigin?: string; 31 margin?: number; 32 }; 33 dotsOptions?: { 34 type?: DotType; 35 color?: string; 36 gradient?: Gradient; 37 }; 38 cornersSquareOptions?: { 39 type?: CornerSquareType; 40 color?: string; 41 gradient?: Gradient; 42 }; 43 cornersDotOptions?: { 44 type?: CornerDotType; 45 color?: string; 46 gradient?: Gradient; 47 }; 48 backgroundOptions?: { 49 round?: number; 50 color?: string; 51 gradient?: Gradient; 52 }; 53};
Property | Type | Default Value |
---|---|---|
style | F_020 , ... F_080 , FE_001 , ... FE_XXX | F_020 |
width | number(0 - max ) | 300 |
height | number(0 - max ) | 300 |
x | number(0 - max ) | 50 |
y | number(0 - max ) | 50 |
texts | UnknownObject[] | - |
contents | UnknownObject[] | - |
containers | UnknownObject[] | - |
Property | Type | Default Value |
---|---|---|
typeNumber | 0 ,40 | 0 |
mode | Numeric , Alphanumeric , Byte , Kanji | |
errorCorrectionLevel | L , M , Q , H | Q |
Property | Type | Default Value | Description |
---|---|---|---|
hideBackgroundDots | boolean | true | Hide all dots covered by the image |
imageSize | number | 0.4 | Coefficient of the image size. Not recommended to use ove 0.5. Lower is better |
margin | number | 0 | Margin of the image in px |
crossOrigin | anonymous , use-credentials | Set "anonymous" if you want to download QR code from other origins. |
Property | Type | Default Value | Description |
---|---|---|---|
color | string | #000 | Color of QR dots |
gradient | object | Gradient of QR dots | |
type | rounded ,dots , classy , classy-rounded , square , extra-rounded | square | Style of QR dots |
Property | Type | Default Value |
---|---|---|
color | string | #fff |
gradient | object |
Property | Type | Default Value | Description |
---|---|---|---|
color | string | Color of Corners Square | |
gradient | object | Gradient of Corners Square | |
type | dot , square , extra-rounded | Style of Corners Square |
Property | Type | Default Value | Description |
---|---|---|---|
color | string | Color of Corners Dot | |
gradient | object | Gradient of Corners Dot | |
type | dot , square | Style of Corners Dot |
dotsOptions.gradient
backgroundOptions.gradient
cornersSquareOptions.gradient
cornersDotOptions.gradient
Property | Type | Default Value | Description |
---|---|---|---|
type | linear , radial | linear | Type of gradient spread |
rotation | number | 0 | Rotation of gradient in radians (Math.PI === 180 degrees) |
colorStops | array of objects | Gradient colors. Example [{ offset: 0, color: 'blue' }, { offset: 1, color: 'red' }] |
dotsOptions.gradient.colorStops[]
backgroundOptions.gradient.colorStops[]
cornersSquareOptions.gradient.colorStops[]
cornersDotOptions.gradient.colorStops[]
Property | Type | Default Value | Description |
---|---|---|---|
offset | 0 , 1 | Position of color in gradient range | |
color | string | Color of stop in gradient range |
Support versions | |
---|---|
Angular 6 | 1.2.3 |
Author Information | |
---|---|
Author | DaiDH |
Phone | +84845882882 |
MIT License. Copyright (c) 2021 DaiDH
No vulnerabilities found.
No security vulnerabilities found.