Skip to content

Commit d221b8d

Browse files
RishikeshBRishikeshBrishidevBalaji
authored
alpha value upgradation (#95)
* alpha value upgradation * default alpha=0.5 * default alpha value=0.5 * dist * fix:added .dist/ to gitignore * Removed dist/ from tracking --------- Co-authored-by: RishikeshB <[email protected]> Co-authored-by: rishidevBalaji <[email protected]>
1 parent b7a6be5 commit d221b8d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/flow.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ function setStyle(ctx, {x, x2, options}) {
3838
let fill;
3939

4040
if (options.colorMode === 'from') {
41-
fill = color(options.colorFrom).alpha(0.5).rgbString();
41+
fill = color(options.colorFrom).alpha(options.alpha).rgbString();
4242
} else if (options.colorMode === 'to') {
43-
fill = color(options.colorTo).alpha(0.5).rgbString();
43+
fill = color(options.colorTo).alpha(options.alpha).rgbString();
4444
} else {
4545
fill = ctx.createLinearGradient(x, 0, x2, 0);
46-
fill.addColorStop(0, color(options.colorFrom).alpha(0.5).rgbString());
47-
fill.addColorStop(1, color(options.colorTo).alpha(0.5).rgbString());
46+
fill.addColorStop(0, color(options.colorFrom).alpha(options.alpha).rgbString());
47+
fill.addColorStop(1, color(options.colorTo).alpha(options.alpha).rgbString());
4848
}
4949

5050
ctx.fillStyle = fill;
@@ -182,6 +182,7 @@ Flow.defaults = {
182182
colorFrom: 'red',
183183
colorTo: 'green',
184184
colorMode: 'gradient',
185+
alpha: 0.5,
185186
hoverColorFrom: (ctx, options) => getHoverColor(options.colorFrom),
186187
hoverColorTo: (ctx, options) => getHoverColor(options.colorTo)
187188
};

0 commit comments

Comments
 (0)