Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] ColorButton #62

Closed
2 tasks done
unknowIfGuestInDream opened this issue May 30, 2024 · 1 comment
Closed
2 tasks done

[Feature Request] ColorButton #62

unknowIfGuestInDream opened this issue May 30, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@unknowIfGuestInDream
Copy link
Owner

Checklist

  • I searched exising issues and no one else requests similar feature.
  • I think that 25%+ users are positive towards this feature.

Describe the feature

https://github.com/greipadmin/greip

Additional context

No response

@unknowIfGuestInDream unknowIfGuestInDream added the enhancement New feature or request label May 30, 2024
@unknowIfGuestInDream unknowIfGuestInDream self-assigned this May 30, 2024
@unknowIfGuestInDream
Copy link
Owner Author

	private Image createImage(final int width, final int height) {
		final PaletteData palette = new PaletteData(0xFF, 0xFF00, 0xFF0000);
		final ImageData source = new ImageData(width, height, 24, palette);

		final Image image = new Image(getDisplay(), source);

		Util.withResource(new GC(image), gc -> {
			final Device device = gc.getDevice();

			if (rgb != null && isEnabled()) {
				Util.withResource(new Color(device, rgb), color -> {
					gc.setBackground(color);
					gc.fillRectangle(0, 0, width, height);
				});
			}

			gc.setForeground(device.getSystemColor(isEnabled() ? SWT.COLOR_DARK_GRAY : SWT.COLOR_GRAY));
			gc.drawRectangle(0, 0, width - 1, height - 1);
		});

		return image;
	}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant