mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 14:20:12 +00:00
[jspdf] Fix setting colors using an HTML color string. (#40405)
This commit is contained in:
committed by
Sheetal Nandi
parent
2296bc56ab
commit
202ea04fc1
9
types/jspdf/index.d.ts
vendored
9
types/jspdf/index.d.ts
vendored
@@ -72,9 +72,12 @@ declare module 'jspdf' {
|
||||
getFontList():any;
|
||||
addFont(postScriptName:string, fontName:string, fontStyle:string):string;
|
||||
setLineWidth(width:number):jsPDF;
|
||||
setDrawColor(ch1:number|string, ch2?:number, ch3?:number, ch4?:number):jsPDF;
|
||||
setFillColor(ch1:number|string, ch2?:number, ch3?:number, ch4?:number):jsPDF;
|
||||
setTextColor(r?:number, g?:number, b?:number):jsPDF;
|
||||
setDrawColor(ch1:number|string):jsPDF;
|
||||
setDrawColor(ch1:number, ch2:number, ch3:number, ch4?:number):jsPDF;
|
||||
setFillColor(ch1:number|string):jsPDF;
|
||||
setFillColor(ch1:number, ch2:number, ch3:number, ch4?:number):jsPDF;
|
||||
setTextColor(ch1:number|string):jsPDF;
|
||||
setTextColor(ch1:number, ch2:number, ch3:number, ch4?: number):jsPDF;
|
||||
setLineCap(style:string|number):jsPDF;
|
||||
setLineJoin(style:string|number):jsPDF;
|
||||
output(type?:string, options?:any):any;
|
||||
|
||||
@@ -95,6 +95,8 @@ function test_text_colors() {
|
||||
doc.text(20, 50, 'This is green.');
|
||||
doc.setTextColor(0, 0, 255);
|
||||
doc.text(20, 60, 'This is blue.');
|
||||
doc.setTextColor('#FF0000');
|
||||
doc.text(20, 60, 'This is red.');
|
||||
doc.save('Test.pdf');
|
||||
}
|
||||
|
||||
@@ -174,9 +176,9 @@ function test_rect_squares() {
|
||||
doc.setDrawColor(0);
|
||||
doc.setFillColor(255, 0, 0);
|
||||
doc.rect(120, 20, 10, 10, 'FD'); // filled red square with black borders
|
||||
doc.setDrawColor(0);
|
||||
doc.setFillColor(255, 255, 255);
|
||||
doc.roundedRect(140, 20, 10, 10, 3, 3, 'FD'); // Black sqaure with rounded corners
|
||||
doc.setDrawColor('#000');
|
||||
doc.setFillColor('#FFFFFF');
|
||||
doc.roundedRect(140, 20, 10, 10, 3, 3, 'FD'); // Black square with rounded corners
|
||||
doc.save('Test.pdf');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user