use system colors, so that they look better when in dark mode

This commit is contained in:
Anton Keks 2020-03-14 12:46:48 -07:00
parent 87e4e08197
commit 4d9b4e0098
2 changed files with 3 additions and 4 deletions

View File

@ -4,7 +4,6 @@ import net.azib.ipscan.config.Labels;
import net.azib.ipscan.config.Version;
import net.azib.ipscan.gui.actions.BrowserLauncher;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Label;
@ -86,12 +85,12 @@ public class AboutDialog extends AbstractModalDialog {
private Label createLinkLabel(final String text, final String url) {
final Label link = new Label(shell, SWT.NONE);
link.setForeground(new Color(null, 0, 0, 0xCC));
link.setForeground(shell.getDisplay().getSystemColor(SWT.COLOR_BLUE));
link.setCursor(shell.getDisplay().getSystemCursor(SWT.CURSOR_HAND));
link.setText(text);
link.addListener(SWT.MouseUp, event -> {
BrowserLauncher.openURL(url);
link.setForeground(new Color(null, 0x88, 0, 0xAA));
link.setForeground(shell.getDisplay().getSystemColor(SWT.COLOR_MAGENTA));
});
link.pack();
return link;

View File

@ -116,7 +116,7 @@ public class StatusBar {
if (!threadsText.isDisposed()) {
boolean maxThreadsReached = runningThreads == scannerConfig.maxThreads;
if (maxThreadsReachedBefore || maxThreadsReached) {
Color newColor = threadsText.getDisplay().getSystemColor(maxThreadsReached ? SWT.COLOR_DARK_RED : SWT.COLOR_WIDGET_FOREGROUND);
Color newColor = threadsText.getDisplay().getSystemColor(maxThreadsReached ? SWT.COLOR_RED : SWT.COLOR_WIDGET_FOREGROUND);
threadsText.setForeground(newColor);
}
maxThreadsReachedBefore = maxThreadsReached;