npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

color-replace-app-core

v0.0.1

Published

a core scripts for https://github.com/mmachado53/wColorizeJS

Downloads

2

Readme

Installation

npm install --save color-replace-app-core

Table of Contents

BoardController

Class representing a controller for board. "new BoardController()"

TOOL_BRUSH

The BoardController.TOOL_BRUSH is a identifier for a brush tool

TOOL_MAGIC_WAND

The BoardController.TOOL_MAGIC_WAND is a identifier for a magic wand tool

TOOL_POLYGON

The BoardController.TOOL_POLYGON is a identifier for a polygon tool

TOOLS

The BoardController.TOOLS is array with all tools

loadImage

load the base image and start all the context of the boardController.

Parameters

  • containerHTMLElement (Window | HTMLElement) the container element for the board canvas
  • url string The URL to download the base image.
  • maxSize Int OPTIONAL maximum size for the base image

Examples

boardControllerInstance.loadImage(htmlElement,imageURL,900).then((canvas)=>{
   htmlElement.appendChild(canvas)
})

Returns Promise<Canvas> the html canvas instance of the board.

getToolsValues

return tools values

Examples

// return [
//             BoardController.TOOL_BRUSH : {size:0,hardness:0,type:1 ( 1 = paint,0 = erease )},
//             BoardController.TOOL_MAGIC_WAND : {tolerance:0,type:1 ( 1 = paint,0 = erease )},
//             ]
boardControllerInstance.loadImage(htmlElement,imageURL,900).then((canvas)=>{
  htmlElement.appendChild(canvas)
})

Returns Array Associative Array

setBrushSize

Set the size of the brush tool

Parameters

  • val Int the new size of the brush

Examples

boardControllerInstance.setBrushSize(20) // the brush size now is 20px

setBrushHardness

Set the hardness of the brush tool

Parameters

  • val Int the new hardness value of the brush (0-100)

Examples

boardControllerInstance.setBrushHardness(20) // the brush size now is 20

setBrushToAdd

Configure the brush tool to paint on the selected layer

setBrushToRemove

Configure the brush tool to erease on the selected layer

setMagicWandTolerance

Configure the magic wand tool with new tolerance

Parameters

  • val Int the new tolerance value (1-200)

fillMagicWand

Allows you to see the result of the magic wand tool without even applying the changes

setMagicWandToAdd

Configure the magic wand tool to paint on the selected layer

setMagicWandToRemove

Configure the magic wand tool to erease on the selected layer

applyMagicWandToSelectedLayer

Apply the results of the magic wand tool in the selected layer

setTool

Set the active tool

Parameters

  • tool String can be BoardController.TOOL_BRUSH, BoardController.TOOL_MAGIC_WAND or BoardController.TOOL_POLYGON

addLayer

Add a new layer and select it

Returns Object object with info of the created layer {id,name,color,hexColor,rgbColor,hsvColor,whiteLevel,blackLevel}

selectLayer

Select a layer based on the id

Parameters

  • id {Int} - Id

Returns Object object with info of the selected layer {id,name,color,hexColor,rgbColor,hsvColor,whiteLevel,blackLevel}

setBlackLevelToSelectedLayer

Set a black level in the selected layer

Parameters

  • val {Int} - new value 0-100

Returns Object object with info of the selected layer {id,name,color,hexColor,rgbColor,hsvColor,whiteLevel,blackLevel}

setWhiteLevelToSelectedLayer

Set a white level in the selected layer

Parameters

  • val {Int} - new value 0-100

Returns Object object with info of the selected layer {id,name,color,hexColor,rgbColor,hsvColor,whiteLevel,blackLevel}

showGlass

Show a magnifying glass

hideGlass

Hide magnifying glass

switchGlass

Show/Hide magnifying glass

setColorToSelectedLayer

Set a color in the selected layer

Parameters

  • colorNumber {Int} - A color number like this 0xff0000

Returns Object object with info of the selected layer {id,name,color,hexColor,rgbColor,hsvColor,whiteLevel,blackLevel}

setHueToSelectedLayer

Set a Hue in the selected layer

Parameters

  • hue {Int} - hue value (0-359)

Returns Object object with info of the selected layer {id,name,color,hexColor,rgbColor,hsvColor,whiteLevel,blackLevel}

setSaturationToSelectedLayer

Set a Saturation in the selected layer

Parameters

  • sat {Number} - saturation value (0.0-1.0)

Returns Object object with info of the selected layer {id,name,color,hexColor,rgbColor,hsvColor,whiteLevel,blackLevel}

setBrightnessToSelectedLayer

Set a Brightness in the selected layer

Parameters

  • brightness {Number} - brightness value (0.0-1.0)

Returns Object object with info of the selected layer {id,name,color,hexColor,rgbColor,hsvColor,whiteLevel,blackLevel}

clearSelection

Clear selection "for polygon tool"