added FlatLaf.isDark()

This commit is contained in:
Karl Tauber
2019-10-29 11:01:48 +01:00
parent 2e0fde464d
commit aa52af4c8f
7 changed files with 31 additions and 2 deletions

View File

@@ -19,6 +19,8 @@ package com.formdev.flatlaf;
/** /**
* A Flat LaF that has a dark color scheme and looks like Darcula LaF. * A Flat LaF that has a dark color scheme and looks like Darcula LaF.
* *
* The UI defaults are loaded from FlatDarculaLaf.properties, FlatDarkLaf.properties and FlatLaf.properties
*
* @author Karl Tauber * @author Karl Tauber
*/ */
public class FlatDarculaLaf public class FlatDarculaLaf

View File

@@ -19,6 +19,8 @@ package com.formdev.flatlaf;
/** /**
* A Flat LaF that has a dark color scheme. * A Flat LaF that has a dark color scheme.
* *
* The UI defaults are loaded from FlatDarkLaf.properties and FlatLaf.properties
*
* @author Karl Tauber * @author Karl Tauber
*/ */
public class FlatDarkLaf public class FlatDarkLaf
@@ -37,4 +39,9 @@ public class FlatDarkLaf
public String getDescription() { public String getDescription() {
return "Flat Dark Look and Feel"; return "Flat Dark Look and Feel";
} }
@Override
public boolean isDark() {
return true;
}
} }

View File

@@ -19,6 +19,8 @@ package com.formdev.flatlaf;
/** /**
* A Flat LaF that has a light color scheme and looks like IntelliJ LaF. * A Flat LaF that has a light color scheme and looks like IntelliJ LaF.
* *
* The UI defaults are loaded from FlatIntelliJLaf.properties, FlatLightLaf.properties and FlatLaf.properties
*
* @author Karl Tauber * @author Karl Tauber
*/ */
public class FlatIntelliJLaf public class FlatIntelliJLaf

View File

@@ -74,6 +74,8 @@ public abstract class FlatLaf
return getName(); return getName();
} }
public abstract boolean isDark();
@Override @Override
public boolean isNativeLookAndFeel() { public boolean isNativeLookAndFeel() {
return true; return true;

View File

@@ -19,6 +19,8 @@ package com.formdev.flatlaf;
/** /**
* A Flat LaF that has a light color scheme. * A Flat LaF that has a light color scheme.
* *
* The UI defaults are loaded from FlatLightLaf.properties and FlatLaf.properties
*
* @author Karl Tauber * @author Karl Tauber
*/ */
public class FlatLightLaf public class FlatLightLaf
@@ -37,4 +39,9 @@ public class FlatLightLaf
public String getDescription() { public String getDescription() {
return "Flat Light Look and Feel"; return "Flat Light Look and Feel";
} }
@Override
public boolean isDark() {
return false;
}
} }

View File

@@ -24,8 +24,9 @@ import java.awt.image.BufferedImage;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.net.URL; import java.net.URL;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
import javax.swing.LookAndFeel;
import javax.swing.UIManager; import javax.swing.UIManager;
import com.formdev.flatlaf.FlatDarkLaf; import com.formdev.flatlaf.FlatLaf;
import com.formdev.flatlaf.ui.FlatUIUtils; import com.formdev.flatlaf.ui.FlatUIUtils;
import com.formdev.flatlaf.util.UIScale; import com.formdev.flatlaf.util.UIScale;
import com.kitfox.svg.app.beans.SVGIcon; import com.kitfox.svg.app.beans.SVGIcon;
@@ -129,6 +130,7 @@ public class ScaledSVGIcon
} }
private static void lafChanged() { private static void lafChanged() {
darkLaf = (UIManager.getLookAndFeel() instanceof FlatDarkLaf); LookAndFeel lookAndFeel = UIManager.getLookAndFeel();
darkLaf = (lookAndFeel instanceof FlatLaf && ((FlatLaf)lookAndFeel).isDark());
} }
} }

View File

@@ -21,6 +21,8 @@ import com.formdev.flatlaf.FlatLaf;
/** /**
* A Flat LaF that has a test color scheme. * A Flat LaF that has a test color scheme.
* *
* The UI defaults are loaded from FlatTestLaf.properties and FlatLaf.properties
*
* Used to develop Flat LaF. * Used to develop Flat LaF.
* *
* @author Karl Tauber * @author Karl Tauber
@@ -37,4 +39,9 @@ public class FlatTestLaf
public String getDescription() { public String getDescription() {
return "Flat Test Look and Feel"; return "Flat Test Look and Feel";
} }
@Override
public boolean isDark() {
return false;
}
} }