Comparing version 0.8.0 to 0.8.1
## Culori Changelog | ||
### 0.8.0 | ||
Adds `culori.blend()` ([#59](https://github.com/Evercoder/culori/issues/59)). | ||
### 0.7.4 | ||
@@ -4,0 +8,0 @@ |
{ | ||
"name": "culori", | ||
"version": "0.8.0", | ||
"version": "0.8.1", | ||
"main": "build/culori.umd.js", | ||
@@ -5,0 +5,0 @@ "browser": "build/culori.umd.js", |
@@ -88,3 +88,3 @@ # Culori | ||
- [Difference](#difference) | ||
- [Blending](#blending) | ||
- [Blending](#blending) | ||
- [Extending culori](#extending-culori) | ||
@@ -423,27 +423,35 @@ | ||
* `normal` | ||
* `multiply` | ||
* `screen` | ||
* `hard-light` | ||
* `overlay` | ||
* `darken` | ||
* `lighten` | ||
* `color-dodge` | ||
* `color-burn` | ||
* `soft-light` | ||
* `difference` | ||
* `exclusion` | ||
- `normal` | ||
- `multiply` | ||
- `screen` | ||
- `hard-light` | ||
- `overlay` | ||
- `darken` | ||
- `lighten` | ||
- `color-dodge` | ||
- `color-burn` | ||
- `soft-light` | ||
- `difference` | ||
- `exclusion` | ||
> **Note:** culori currently implements the _separable_ blend modes, that is the blend modes that work on each channel in the color space independently. _color_, _hue_, _saturation_, and _lightness_ modes are not yet available. | ||
An example of blending three colors: | ||
```js | ||
culori.blend( | ||
[ | ||
'rgba(255, 0, 0, 0.5)', | ||
'rgba(0, 255, 0, 0.5)', | ||
'rgba(0, 0, 255, 0.5)', | ||
], | ||
['rgba(255, 0, 0, 0.5)', 'rgba(0, 255, 0, 0.5)', 'rgba(0, 0, 255, 0.5)'], | ||
'screen' | ||
) | ||
); | ||
// => { mode: 'rgb', alpha: 0.875, r: 0.57..., g: 0.57..., b:0.57... } | ||
``` | ||
In addition to strings, the _type_ parameter supports a _function (b, s) → v_ that takes the values of the _backdrop_ and _source_ color to return the blended value. This allows you to write your own (separable) blending functions. For example, an _average_ blending mode: | ||
```js | ||
culori.blend(['red', 'green'], function average(b, s) { | ||
return (b + s) / 2; | ||
}); | ||
``` | ||
### Extending culori | ||
@@ -450,0 +458,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
116607
725