diff --git a/CHANGELOG.md b/CHANGELOG.md index 238c8261..dd756c24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,10 @@ FlatLaf Change Log - Linux: Fixed slightly different font size (or letter width) used to paint HTML text when default font family is _Cantarell_ (e.g. on Fedora). (issue #912) +#### Other Changes + +- Class `FlatPropertiesLaf` now supports FlatLaf macOS themes as base themes. + ## 3.5.2 diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatPropertiesLaf.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatPropertiesLaf.java index bcf296b6..d16d1b96 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatPropertiesLaf.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatPropertiesLaf.java @@ -23,13 +23,15 @@ import java.io.InputStream; import java.util.ArrayList; import java.util.Locale; import java.util.Properties; +import com.formdev.flatlaf.themes.FlatMacDarkLaf; +import com.formdev.flatlaf.themes.FlatMacLightLaf; /** * A Flat LaF that is able to load UI defaults from properties passed to the constructor. *

* Specify the base theme in the properties with {@code @baseTheme=}. * Allowed values for {@code } are {@code light} (the default), {@code dark}, - * {@code intellij} or {@code darcula}. + * {@code intellij}, {@code darcula}, {@code maclight} or {@code macdark}. *

* The properties are applied after loading the base theme and may overwrite base properties. * All features of FlatLaf properties files are available. @@ -71,7 +73,8 @@ public class FlatPropertiesLaf this.properties = properties; baseTheme = properties.getProperty( "@baseTheme", "light" ); - dark = "dark".equalsIgnoreCase( baseTheme ) || "darcula".equalsIgnoreCase( baseTheme ); + dark = "dark".equalsIgnoreCase( baseTheme ) || "darcula".equalsIgnoreCase( baseTheme ) || + "macdark".equalsIgnoreCase( baseTheme ); } @Override @@ -116,6 +119,16 @@ public class FlatPropertiesLaf lafClasses.add( FlatDarkLaf.class ); lafClasses.add( FlatDarculaLaf.class ); break; + + case "maclight": + lafClasses.add( FlatLightLaf.class ); + lafClasses.add( FlatMacLightLaf.class ); + break; + + case "macdark": + lafClasses.add( FlatDarkLaf.class ); + lafClasses.add( FlatMacDarkLaf.class ); + break; } return lafClasses; } diff --git a/flatlaf-demo/DemoLaf.properties b/flatlaf-demo/DemoLaf.properties index 0a4930b0..80ee1379 100644 --- a/flatlaf-demo/DemoLaf.properties +++ b/flatlaf-demo/DemoLaf.properties @@ -6,7 +6,7 @@ # when the Demo window is activated. -# base theme (light, dark, intellij or darcula) +# base theme (light, dark, intellij, darcula, maclight or macdark) @baseTheme = light # add you theme defaults here diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePropertiesSupport.java b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePropertiesSupport.java index 97339783..0f28c256 100644 --- a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePropertiesSupport.java +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePropertiesSupport.java @@ -241,7 +241,7 @@ class FlatThemePropertiesSupport } static boolean isDark( String baseTheme ) { - return "dark".equals( baseTheme ) || "darcula".equals( baseTheme ); + return "dark".equals( baseTheme ) || "darcula".equals( baseTheme ) || "macdark".equals( baseTheme ); } private String getBaseTheme() {