From 819b1d9cd68a4638f3fa74ae445253d7e768108b Mon Sep 17 00:00:00 2001 From: Vera Petrenkova Date: Tue, 28 Nov 2023 14:07:04 +0100 Subject: [PATCH] IDEA-338576 using alpha in saturation calculating GitOrigin-RevId: 5997eaed9748cc0682b961bd974a205d19bd9a53 --- .../src/com/intellij/ide/ProjectWindowCustomizerService.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/ide/ProjectWindowCustomizerService.kt b/platform/platform-impl/src/com/intellij/ide/ProjectWindowCustomizerService.kt index 2cb3f1851d13..e73d670560bb 100644 --- a/platform/platform-impl/src/com/intellij/ide/ProjectWindowCustomizerService.kt +++ b/platform/platform-impl/src/com/intellij/ide/ProjectWindowCustomizerService.kt @@ -364,8 +364,11 @@ class ProjectWindowCustomizerService : Disposable { } ?: 150f if (ComponentUtil.findComponentsOfType(parent, MainToolbar::class.java).firstOrNull() == null && !isToolbarInHeader()) return true - val saturation = Registry.doubleValue("ide.colorful.toolbar.gradient.saturation", 0.85).coerceIn(0.0, 1.0) - val blendedColor = ColorUtil.blendColorsInRgb(parent.background, color, saturation).let { ColorUtil.toAlpha(it, color.alpha) } + + //additional multiplication by color.alpha is done because alpha will be lost after using blendColorsInRgb (sometimes it's not equals to 255) + val saturation = Registry.doubleValue("ide.colorful.toolbar.gradient.saturation", 0.85) + .coerceIn(0.0, 1.0) * (color.alpha.toDouble() / 255) + val blendedColor = ColorUtil.blendColorsInRgb(parent.background, color, saturation) val leftBound = (offset - length).coerceAtLeast(0f).toInt() g.paint = leftGradientCache.getTexture(g, (offset - leftBound).toInt(), parent.background, blendedColor, leftBound) g.fillRect(leftBound, 0, (offset - leftBound).toInt(), height)