Change InkSketch InkColor

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
User avatar
smithme
Posts: 45
Joined: Wed Jul 26, 2017

01 Aug 2017

What is the syntax to change the InkColor of an InkSketch control?

I have tried:
$('.sketch').InkColor(clr);

And:
$('.sketch').css('color', clr);

Neither worked.
City of Nampa
Idaho
United States of America

User avatar
smithme
Posts: 45
Joined: Wed Jul 26, 2017

01 Aug 2017

I found the fd_inkcolor attribute. I have tried:
var clr = $(this).css('background-color');
$('.sketch').data("fd_inkcolor", clr);

It still isn't working.
City of Nampa
Idaho
United States of America

User avatar
Nikita Kurguzov
Posts: 889
Joined: Mon Jul 03, 2017

02 Aug 2017

Hello!
Simply use this code and don't forget to change CSS class to the class of your InkSketch control:

Code: Select all

$(".CSSclass").attr("fd_inkcolor", "#ff0000");
Cheers

User avatar
smithme
Posts: 45
Joined: Wed Jul 26, 2017

02 Aug 2017

Of course. Thanks.
City of Nampa
Idaho
United States of America

User avatar
smithme
Posts: 45
Joined: Wed Jul 26, 2017

02 Aug 2017

I used your code and it works. I can watch the dom in the browser and the fd_inkcolor is changing but when I draw on the control it still only draws in black. Is there something else I need to do for the ink color change to take effect?
City of Nampa
Idaho
United States of America

User avatar
Nikita Kurguzov
Posts: 889
Joined: Mon Jul 03, 2017

03 Aug 2017

Yes, the code indeed doesn't change the pen color dynamically, it only applies when the canvas is being created.

In order to change it dynamically, please use:

Code: Select all

var signaturePad = $('.CSSclass').data('signaturePad');
signaturePad.penColor = 'rgb(66, 133, 244)';
Cheers

User avatar
smithme
Posts: 45
Joined: Wed Jul 26, 2017

03 Aug 2017

This is awesome. Thank you.
City of Nampa
Idaho
United States of America

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests