Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Use the shared color blend helper from SWT

Abierto
#4,486 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

  • #4489 de @vogella — cerrado sin fusionar

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
18/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
java

Línea de trabajo

Start with org.eclipse.jface.resource.JFaceColors and the existing private blend copies listed in the issue, such as PopupDialog.blend and Colors.blend. The open question is the ratio type, which the issue leaves undecided, so the design needs maintainer input. A pull request (#4489) is already open against this issue, so check its state and discussion before starting. Done means one public RGB blend in JFaceColors with the public Forms and Workbench versions delegating to it, and no color shift.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.
  • Replace the private copies with RGB.blend:
Bundle Copy Replacement
jface PopupDialog.blend(bg, fg, factor) bg.blend(fg, factor)
jface.databinding SWTUtil.mix(rgb1, rgb2, ratio) rgb2.blend(rgb1, ratio)
jface.text Colors.blend(bg, fg, factor), projection SourceViewerInformationControl.blend bg.blend(fg, factor)
jface.text OverviewRuler.interpolate(fg, bg, scale), DiffPainter.interpolate fg.blend(bg, scale)
ui.editors SourceViewerInformationControl.blend(bg, fg, factor) bg.blend(fg, factor)
ui.workbench ShowViewDialog.blend(c1, c2, ratio) c2.blend(c1, ratio / 100.0)
ui.workbench HeapStatus.blend(fg, bg) (40% foreground) bg.getRGB().blend(fg.getRGB(), 0.4)
e4 renderers CTabRendering.blend(c1, c2, ratio) c2.blend(c1, ratio / 100.0)
  • 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.

Lenguaje dominante
Java
Estrellas
124
Forks
269
Merge medio
2 d 6 h
PR fusionados (30 d)
69

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de eclipse-platform/eclipse.platform.ui

Todos los issues de eclipse-platform/eclipse.platform.ui

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.