mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-06 05:50:53 +03:00
FlatPropertiesLaf: support macOS themes as base themes
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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.
|
||||
* <p>
|
||||
* Specify the base theme in the properties with {@code @baseTheme=<baseTheme>}.
|
||||
* Allowed values for {@code <baseTheme>} are {@code light} (the default), {@code dark},
|
||||
* {@code intellij} or {@code darcula}.
|
||||
* {@code intellij}, {@code darcula}, {@code maclight} or {@code macdark}.
|
||||
* <p>
|
||||
* 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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user