DEV Community

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

Posted on • Edited on

3 2

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

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

SurveyJS custom survey software

JavaScript UI Libraries for Surveys and Forms

SurveyJS lets you build a JSON-based form management system that integrates with any backend, giving you full control over your data and no user limits. Includes support for custom question types, skip logic, integrated CCS editor, PDF export, real-time analytics & more.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay