mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Add lightness option to modulate operation
This commit is contained in:
@@ -18,7 +18,9 @@ describe('Modulate', function () {
|
||||
{ saturation: null },
|
||||
{ hue: '50deg' },
|
||||
{ hue: 1.5 },
|
||||
{ hue: null }
|
||||
{ hue: null },
|
||||
{ lightness: '+50' },
|
||||
{ lightness: null }
|
||||
].forEach(function (options) {
|
||||
it('should throw', function () {
|
||||
assert.throws(function () {
|
||||
@@ -108,6 +110,22 @@ describe('Modulate', function () {
|
||||
assert.deepStrictEqual({ r: 127, g: 83, b: 81 }, { r, g, b });
|
||||
});
|
||||
|
||||
it('should be able to lighten', async () => {
|
||||
const [r, g, b] = await sharp({
|
||||
create: {
|
||||
width: 1,
|
||||
height: 1,
|
||||
channels: 3,
|
||||
background: { r: 153, g: 68, b: 68 }
|
||||
}
|
||||
})
|
||||
.modulate({ lightness: 10 })
|
||||
.raw()
|
||||
.toBuffer();
|
||||
|
||||
assert.deepStrictEqual({ r: 182, g: 93, b: 92 }, { r, g, b });
|
||||
});
|
||||
|
||||
it('should be able to modulate all channels', async () => {
|
||||
const [r, g, b] = await sharp({
|
||||
create: {
|
||||
|
||||
Reference in New Issue
Block a user