Skip to content

Add an e4 example that sets the SVG currentColor at startup - #1

Merged
vogella merged 1 commit into
mainfrom
ccr-e0b57c95-8maup8
Oct 16, 2026
Merged

vogella merged 1 commit into
mainfrom
ccr-e0b57c95-8maup8

Conversation

@vogella

@vogella vogella commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

New e4 RCP example com.vogella.rcp.svg.currentcolor. It sets the color that SVG icons use for currentColor before the workbench window is rendered. The CSS property swt-svg-current-color from eclipse-platform/eclipse.platform.ui#4497 isn't available yet, so the example calls the SWT method SVGFileFormat.setCurrentColor(RGB) directly.

How the color is set

  • Login dialog: a @PostContextCreate lifecycle opens a login screen with user and password fields and an icon color picker (presets plus a ColorDialog). The preview is rasterized again on every change. Clicking Login passes the chosen color to SVGFileFormat.setCurrentColor.
  • Program argument: -currentColor RRGGBB preselects the color in the dialog. The .product passes 1E88E5. Write the value without the #, because the launcher ini treats a line that starts with # as a comment, and so does a shell after a space.
  • System property: SWT's own -Dswt.svg.currentColor=RRGGBB still works. It is preselected when no program argument is given.

All the icons (menu, toolbar, part tabs, part contents) are SVGs with fill/stroke="currentColor".

Target platform

setCurrentColor was added to SWT on 2026-10-15, so it isn't in the 2026-09 release. The target now resolves from https://download.eclipse.org/eclipse/updates/4.42-I-builds/. It should switch to the 2026-12 release once that ships. CLAUDE.md and README note this.

Testing

  • mvn clean verify passes for the whole reactor on JDK 25.
  • I materialized the product for linux/gtk and ran it under Xvfb. With the argument, the dialog preselected blue and every icon came out #1E88E5. With no argument, I picked "Orange" in the dialog and the workbench icons came out #EF6C00.

com.vogella.rcp.svg.currentcolor shows a login dialog before the
workbench window is rendered. The user picks the icon color there, with
a live preview, and the lifecycle passes it to
SVGFileFormat.setCurrentColor, so all currentColor SVG icons in the
menu, toolbar, part tabs and parts use it. A -currentColor RRGGBB
program argument preselects the color; SWT's swt.svg.currentColor
system property still works as well.

The CSS property swt-svg-current-color proposed in eclipse.platform.ui
pull request 4497 is not available yet, so the example uses the SWT
method directly. That method is newer than the 2026-09 release, so the
target platform now uses the 4.42 I-builds.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01As7ZUt86VBsfVRcjyZwyqf
@vogella
vogella merged commit d440ab9 into main Oct 16, 2026
vogella added a commit that referenced this pull request Oct 16, 2026
com.vogella.rcp.svg.currentcolor shows a login dialog before the
workbench window is rendered. The user picks the icon color there, with
a live preview, and the lifecycle passes it to
SVGFileFormat.setCurrentColor, so all currentColor SVG icons in the
menu, toolbar, part tabs and parts use it. A -currentColor RRGGBB
program argument preselects the color; SWT's swt.svg.currentColor
system property still works as well.

The CSS property swt-svg-current-color proposed in eclipse.platform.ui
pull request 4497 is not available yet, so the example uses the SWT
method directly. That method is newer than the 2026-09 release, so the
target platform now uses the 4.42 I-builds.

Assisted-by: multiple AI agents and layers of automated tooling 🤖
vogella added a commit that referenced this pull request Oct 16, 2026
com.vogella.rcp.svg.currentcolor shows a login dialog before the
workbench window is rendered. The user picks the icon color there, with
a live preview, and the lifecycle passes it to
SVGFileFormat.setCurrentColor, so all currentColor SVG icons in the
menu, toolbar, part tabs and parts use it. A -currentColor RRGGBB
program argument preselects the color; SWT's swt.svg.currentColor
system property still works as well.

The CSS property swt-svg-current-color proposed in eclipse.platform.ui
pull request 4497 is not available yet, so the example uses the SWT
method directly. That method is newer than the 2026-09 release, so the
target platform now uses the 4.42 I-builds.
vogella added a commit that referenced this pull request Oct 16, 2026
com.vogella.rcp.svg.currentcolor shows a login dialog before the
workbench window is rendered. The user picks the icon color there, with
a live preview, and the lifecycle passes it to
SVGFileFormat.setCurrentColor, so all currentColor SVG icons in the
menu, toolbar, part tabs and parts use it. A -currentColor RRGGBB
program argument preselects the color; SWT's swt.svg.currentColor
system property still works as well.

The CSS property swt-svg-current-color proposed in eclipse.platform.ui
pull request 4497 is not available yet, so the example uses the SWT
method directly. That method is newer than the 2026-09 release, so the
target platform now uses the 4.42 I-builds.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants