diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatStyleSupport.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatStyleSupport.java index 763e40e4..3fb6b7de 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatStyleSupport.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatStyleSupport.java @@ -33,6 +33,7 @@ import javax.swing.border.Border; import com.formdev.flatlaf.FlatClientProperties; import com.formdev.flatlaf.FlatLaf; import com.formdev.flatlaf.util.StringUtils; +import com.formdev.flatlaf.util.SystemInfo; /** * Support for styling components in CSS syntax. @@ -109,6 +110,19 @@ public class FlatStyleSupport String key = e.getKey(); Object newValue = e.getValue(); + if( key.startsWith( "[" ) ) { + if( (SystemInfo.isWindows && key.startsWith( "[win]" )) || + (SystemInfo.isMacOS && key.startsWith( "[mac]" )) || + (SystemInfo.isLinux && key.startsWith( "[linux]" )) || + (key.startsWith( "[light]" ) && !FlatLaf.isLafDark()) || + (key.startsWith( "[dark]" ) && FlatLaf.isLafDark()) ) + { + // prefix is known and enabled --> remove prefix + key = key.substring( key.indexOf( ']' ) + 1 ); + } else + continue; + } + Object oldValue = applyProperty.apply( key, newValue ); oldValues.put( key, oldValue ); }