loilo / color-blend Goto Github PK
View Code? Open in Web Editor NEWšØ Blends RGBA colors with various blend modes in JavaScript
License: MIT License
šØ Blends RGBA colors with various blend modes in JavaScript
License: MIT License
To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:
.travis.yml
If youāre interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.
Greenkeeper has checked the engines
key in any package.json
file, the .nvmrc
file, and the .travis.yml
file, if present.
engines
was only updated if it defined a single version, not a range..nvmrc
was updated to Node.js 10.travis.yml
was only changed if there was a root-level node_js
that didnāt already include Node.js 10, such as node
or lts/*
. In this case, the new version was appended to the list. We didnāt touch job or matrix configurations because these tend to be quite specific and complex, and itās difficult to infer what the intentions were.For many simpler .travis.yml
configurations, this PR should suffice as-is, but depending on what youāre doing it may require additional work or may not be applicable at all. Weāre also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, Iām a humble robot and wonāt feel rejected š¤
There is a collection of frequently asked questions. If those donāt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot š“
With TypeScript 3.1.3, importing any of the exported color-blend members, e.g.:
import {colorBurn} from "color-blend";
results in error:
Cannot find module './types'.
I have found getLuminosity/setLuminosity/getSaturation/setSaturation, but I want to change hue of a color.
If white with an alpha value is passed to multiply
the non-white value is returned:
Multiply w\ white:
{
backdrop: { r: 255, g: 255, b: 255, a: 0.12 }, // White
source: { r: 0, g: 107, b: 84, a: 1 }, // Non-White
ret: { r: 0, g: 107, b: 84, a: 1 } // SAME Non-White Value
}
It works with a non-white source
or backdrop
value:
Multiply w\ non-white:
{
backdrop: { r: 0, g: 107, b: 84, a: 0.12 },
source: { r: 251, g: 253, b: 250, a: 1 },
ret: { r: 221, g: 235, b: 230, a: 1 }
}
Is this the expected behavior? I'm getting accurate results when multiplying non-white values.
const { multiply } = require("color-blend");
const colorWhiteAlpha12 = { r: 255, g: 255, b: 255, a: 0.12 };
const colorPrimary = { r: 0, g: 107, b: 84, a: 1 };
const colorSurface = { r: 251, g: 253, b: 250, a: 1 };
const colorPrimaryAlpha12 = { r: 0, g: 107, b: 84, a: 0.12 };
const colorPrimaryTint = multiply(colorWhiteAlpha12, colorPrimary);
const colorSurfaceTint = multiply(colorPrimaryAlpha12, colorSurface);
console.log("colorPrimaryTint: ", colorPrimaryTint);
console.log("colorSurfaceTint: ", colorSurfaceTint);
/* OUTPUT
colorPrimaryTint: { r: 0, g: 107, b: 84, a: 1 } - Same as `colorPrimary`
colorSurfaceTint: { r: 221, g: 235, b: 230, a: 1 }
*/
I found this package in this comment: https://github.com/Qix-/color/issues/99#issuecomment-266601291
i thought that it would be directly compatible with color, but its not totally:
e.g. this leads to wrong results, because color-blends needs an alpha channel (property a
):
import Color from 'color'
import blender from 'color-blend'
const color1 = Color("#B5E684")
const colorBlended = blender.normal(color1, Color("yellow")) // returns {r: NaN, g: NaN, b: NaN, a: NaN}
I'm new to color blending. If I have a pixel in the photo that represents true red, green and then blue, based on how much each of these is off can I use this library to correct the pixels in the rest of the image?
For example if red in the photo appears as 240,13,85 when it should be 255,0,0 I'd like to apply the correction to the rest of the pixels. Same for the green pixel and blue.
Hello! Thank you very much for time and efforts put into this library.
May i draw your attention to one nuance?
I'm trying to use your great library with polished
npm-package, cause i work on design-system and i need to blend some colors, with blend-modes, but i need to put some extra time because of the following.
Issue
Function rgba
from polished
works as follows
rgba(255, 205, 100, 0.7) or rgba({ red: 255, green: 205, blue: 100, alpha: 0.7 })
But you package's output is { r: number, g: number, b: number, a: number }. so in order to use polished
i need to write 2 functions
1st - to convert any polished
result to entry format of your library
2nd - convert your library output to format, that polished
understands
My proposal
Please, make color-blend
output format either / or
a) an object { red: number, green: number, blue: number, alpha: number }
b) array of RGBA values as numbers [, , , ,] which then can be passed with ...spread syntax out of the box
This can be achieved either / or
color-blend/unit
P.S.
With all the respect, it is just a proposal.
I dont have any problems writing such functions on my own in my project.
I just think this could help other people to use your library in more wide and flexible way, thats all.
Best wishes and kind regards,
Artemiy
šØ You need to enable Continuous Integration on all branches of this repository. šØ
To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.
Since we didnāt receive a CI status on the greenkeeper/initial
branch, itās possible that you donāt have CI set up yet. We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.
If you have already set up a CI for this repository, you might need to check how itās configured. Make sure it is set to run on all new branches. If you donāt want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/
.
Once you have installed and configured CI on this repository correctly, youāll need to re-trigger Greenkeeperās initial pull request. To do this, please delete the greenkeeper/initial
branch in this repository, and then remove and re-add this repository to the Greenkeeper Appās white list on Github. You'll find this list on your repo or organizationās settings page, under Installed GitHub Apps.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ššš
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ā¤ļø Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.