DEV Community

Cover image for Gif Widget : "Paint it Black"
egfx
egfx

Posted on • Updated on

Gif Widget : "Paint it Black"


The template includes everything you need to create a toolbar app in gif.com.ai

Today we will do a teardown of the "Paint it Black" widget. This is a very basic widget that you pin to your toolbar. The template to the "Paint it Black" widget is included at the bottom of this post.


Comes in two parts:

1) JS Context

The JS consists of a single jquery selector.

Every time the toolbar button is clicked the code is executed, resulting in everything in the canvas turning grayscale.

$('#gifcanvas > *').css('filter', 'grayscale(1)');
Enter fullscreen mode Exit fullscreen mode

2) Settings Context

We included the title, description and mode properties in settings. The title and description are straight forward additions.

Note the special mode property with the value of pin. Including this property and setting the value to pin tells our gif webtop that this item belongs in the toolbar.

{
    title: "Paint it BLACK",
    description: "No colors anymore I want them to turn black. Turns everything in the gif canvas grayscale.",
    mode: "pin"
}
Enter fullscreen mode Exit fullscreen mode

Check out "Paint it Black" with our starter template below.

Open template

Top comments (0)