You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Blending two RGB values by a ratio is implemented over a dozen times in platform.ui, each with its own parameter type and rounding.
Following the discussion in #4489, SWT now provides the shared helper: RGB.blend(RGB other, double weight) and RGBA.blend(RGBA other, double weight) (eclipse-platform/eclipse.platform.swt#3732, @since 3.136).
The weight is the share of other, from 0 (the receiver) to 1 (other), and channels are rounded to the nearest integer.
Work to do in platform.ui, once SWT 3.136 is in the target platform:
Raise the org.eclipse.swt lower bound to 3.136 in each touched bundle's MANIFEST.MF.
Keep the public API and let it delegate: FormColors.blend(c1, c2, ratio) and ColorUtil.blend(c1, c2, ratio) become c2.blend(c1, ratio / 100.0), and ColorUtil.blend(val1, val2) becomes val1.blend(val2, 0.5).
The copies truncate while RGB.blend rounds, so a migrated color can differ by one per channel.
Tests that compare exact RGB values need adjusting rather than a rounding shim.
Copies in other repositories (Compare in eclipse.platform, JDT UI, PDE, GEF Classic's FigureUtilities) can follow the same way.
Not just the Platform uses such a helper method . Having a "central" blend function would be very much appreciated. I'm not sure if JFaceColors is the best place to put it, because it doesn't really fit the description:
JFaceColors is the class that stores references to all of the colors used by JFace.
Activity
ptziegler commentedon Oct 13, 2026
Not just the Platform uses such a helper method . Having a "central" blend function would be very much appreciated. I'm not sure if
JFaceColorsis the best place to put it, because it doesn't really fit the description:But I also don't see a better place to put it.
Provide a shared color blend helper in JFaceColors
Provide a shared color blend helper in JFaceColors
laeubi commentedon Oct 14, 2026
See my comment here I think it makes much sense to add this to SWT directly instead especially as your claim
vogella commentedon Oct 14, 2026
See eclipse-platform/eclipse.platform.swt#3732
[-]Provide a shared color blend helper in JFace[/-][+]Use the shared color blend helper from SWT[/+]