mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-06 22:10:54 +03:00
FlatLaf.isLafDark() added
This commit is contained in:
@@ -113,6 +113,14 @@ public abstract class FlatLaf
|
|||||||
|
|
||||||
public abstract boolean isDark();
|
public abstract boolean isDark();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the current look and feel is dark.
|
||||||
|
*/
|
||||||
|
public static boolean isLafDark() {
|
||||||
|
LookAndFeel lookAndFeel = UIManager.getLookAndFeel();
|
||||||
|
return lookAndFeel instanceof FlatLaf && ((FlatLaf)lookAndFeel).isDark();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether FlatLaf supports custom window decorations.
|
* Returns whether FlatLaf supports custom window decorations.
|
||||||
* This depends on the operating system and on the used Java runtime.
|
* This depends on the operating system and on the used Java runtime.
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ import java.net.URL;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import javax.swing.Icon;
|
import javax.swing.Icon;
|
||||||
import javax.swing.LookAndFeel;
|
|
||||||
import javax.swing.UIManager;
|
import javax.swing.UIManager;
|
||||||
import com.formdev.flatlaf.FlatIconColors;
|
import com.formdev.flatlaf.FlatIconColors;
|
||||||
import com.formdev.flatlaf.FlatLaf;
|
import com.formdev.flatlaf.FlatLaf;
|
||||||
@@ -164,8 +163,7 @@ public class FlatSVGIcon
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void lafChanged() {
|
private static void lafChanged() {
|
||||||
LookAndFeel lookAndFeel = UIManager.getLookAndFeel();
|
darkLaf = FlatLaf.isLafDark();
|
||||||
darkLaf = (lookAndFeel instanceof FlatLaf && ((FlatLaf)lookAndFeel).isDark());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---- class ColorFilter --------------------------------------------------
|
//---- class ColorFilter --------------------------------------------------
|
||||||
|
|||||||
@@ -598,12 +598,7 @@ public class FlatDisabledIconsTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
private ImageIcon getCurrentIcon() {
|
private ImageIcon getCurrentIcon() {
|
||||||
return isDark() ? darkIcon : lightIcon;
|
return FlatLaf.isLafDark() ? darkIcon : lightIcon;
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isDark() {
|
|
||||||
LookAndFeel lookAndFeel = UIManager.getLookAndFeel();
|
|
||||||
return lookAndFeel instanceof FlatLaf && ((FlatLaf)lookAndFeel).isDark();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -399,8 +399,7 @@ public class FlatTestFrame
|
|||||||
boolean explicit = explicitColorsCheckBox.isSelected();
|
boolean explicit = explicitColorsCheckBox.isSelected();
|
||||||
ColorUIResource restoreColor = new ColorUIResource( Color.white );
|
ColorUIResource restoreColor = new ColorUIResource( Color.white );
|
||||||
|
|
||||||
LookAndFeel lookAndFeel = UIManager.getLookAndFeel();
|
boolean dark = FlatLaf.isLafDark();
|
||||||
boolean dark = (lookAndFeel instanceof FlatLaf && ((FlatLaf)lookAndFeel).isDark());
|
|
||||||
Color magenta = dark ? Color.magenta.darker() : Color.magenta;
|
Color magenta = dark ? Color.magenta.darker() : Color.magenta;
|
||||||
Color orange = dark ? Color.orange.darker() : Color.orange;
|
Color orange = dark ? Color.orange.darker() : Color.orange;
|
||||||
Color blue = dark ? Color.blue.darker() : Color.blue;
|
Color blue = dark ? Color.blue.darker() : Color.blue;
|
||||||
|
|||||||
Reference in New Issue
Block a user