Skip to content

Commit

Permalink
Added better rendering for gradients
Browse files Browse the repository at this point in the history
  • Loading branch information
mauro-balades committed Feb 27, 2025
1 parent 7d20a9e commit 99ab59f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/browser/base/zen-components/ZenGradientGenerator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -882,8 +882,14 @@
return forToolbar ? 'var(--zen-themed-toolbar-bg)' : 'var(--zen-themed-toolbar-bg-transparent)';
} else if (themedColors.length === 1) {
return this.getSingleRGBColor(themedColors[0], forToolbar);
} else if (themedColors.length !== 3) {
return `linear-gradient(${this.currentRotation}deg, ${themedColors.map((color) => this.getSingleRGBColor(color, forToolbar)).join(', ')})`;
} else {
let color1 = this.getSingleRGBColor(themedColors[2], forToolbar);
let color2 = this.getSingleRGBColor(themedColors[0], forToolbar);
let color3 = this.getSingleRGBColor(themedColors[1], forToolbar);
return `linear-gradient(${this.currentRotation}deg, ${color1}, ${color2}, ${color3})`;
}
return `linear-gradient(${this.currentRotation}deg, ${themedColors.map((color) => this.getSingleRGBColor(color, forToolbar)).join(', ')})`;
}

static getTheme(colors = [], opacity = 0.5, rotation = -45, texture = 0) {
Expand Down

0 comments on commit 99ab59f

Please sign in to comment.