File tree Expand file tree Collapse file tree 3 files changed +37
-11
lines changed Expand file tree Collapse file tree 3 files changed +37
-11
lines changed Original file line number Diff line number Diff line change 1
1
import * as Jimp from "jimp" ;
2
+ import { ColorActionName } from "@jimp/plugin-color" ;
2
3
3
4
const jimpInst : Jimp = new Jimp ( "test" ) ;
4
5
@@ -11,6 +12,7 @@ jimpInst.displace(jimpInst, 2);
11
12
jimpInst . shadow ( ( err , val , coords ) => { } ) ;
12
13
jimpInst . fishEye ( { r : 12 } ) ;
13
14
jimpInst . circle ( { radius : 12 , x : 12 , y : 12 } ) ;
15
+ jimpInst . color ( [ { apply : ColorActionName . SATURATE , params : [ 90 ] } ] ) ;
14
16
// $ExpectError
15
17
jimpInst . PNG_FILTER_NONE ;
16
18
Original file line number Diff line number Diff line change 1
1
import { ImageCallback } from "@jimp/core" ;
2
2
3
- type ColorActionName =
4
- | "mix"
5
- | "tint"
6
- | "shade"
7
- | "xor"
8
- | "red"
9
- | "green"
10
- | "blue"
11
- | "hue"
12
- | "lighten"
13
- | "darken" ;
3
+ export enum ColorActionName {
4
+ LIGHTEN = "lighten" ,
5
+ BRIGHTEN = "brighten" ,
6
+ DARKEN = "darken" ,
7
+ DESATURATE = "desaturate" ,
8
+ SATURATE = "saturate" ,
9
+ GREYSCALE = "greyscale" ,
10
+ SPIN = "spin" ,
11
+ HUE = "hue" ,
12
+ MIX = "mix" ,
13
+ TINT = "tint" ,
14
+ SHADE = "shade" ,
15
+ XOR = "xor" ,
16
+ RED = "red" ,
17
+ GREEN = "green" ,
18
+ BLUE = "blue" ,
19
+ }
14
20
15
21
type ColorAction = {
16
22
apply : ColorActionName ;
Original file line number Diff line number Diff line change @@ -128,6 +128,24 @@ function colorFn(actions, cb) {
128
128
return this ;
129
129
}
130
130
131
+ export const ColorActionName = Object . freeze ( {
132
+ LIGHTEN : "lighten" ,
133
+ BRIGHTEN : "brighten" ,
134
+ DARKEN : "darken" ,
135
+ DESATURATE : "desaturate" ,
136
+ SATURATE : "saturate" ,
137
+ GREYSCALE : "greyscale" ,
138
+ SPIN : "spin" ,
139
+ HUE : "hue" ,
140
+ MIX : "mix" ,
141
+ TINT : "tint" ,
142
+ SHADE : "shade" ,
143
+ XOR : "xor" ,
144
+ RED : "red" ,
145
+ GREEN : "green" ,
146
+ BLUE : "blue" ,
147
+ } ) ;
148
+
131
149
export default ( ) => ( {
132
150
/**
133
151
* Adjusts the brightness of the image
You can’t perform that action at this time.
0 commit comments