Compare commits

..

2 Commits

Author SHA1 Message Date
Karl Tauber
45e7022deb Fonts: updated JetBrains Mono to v2.304 2023-01-19 00:06:00 +01:00
Karl Tauber
32dce16363 Styling: fixed resolving of UI variables in styles that use other variables 2023-01-18 23:26:34 +01:00
9 changed files with 27 additions and 7 deletions

View File

@@ -5,8 +5,11 @@ FlatLaf Change Log
#### New features and improvements #### New features and improvements
- Fonts: Added **Roboto - Fonts:
Mono** (https://fonts.google.com/specimen/Roboto+Mono). (PR #639, issue #638) - Added **Roboto Mono** (https://fonts.google.com/specimen/Roboto+Mono). (PR
#639, issue #638)
- Updated **JetBrains Mono** to
[v2.304](https://github.com/JetBrains/JetBrainsMono/releases/tag/v2.304).
#### Fixed bugs #### Fixed bugs
@@ -20,6 +23,7 @@ FlatLaf Change Log
#628) #628)
- Avoid that accent color affect some colors in some IntelliJ themes. (issue - Avoid that accent color affect some colors in some IntelliJ themes. (issue
#625) #625)
- Styling: Fixed resolving of UI variables in styles that use other variables.
## 3.0 ## 3.0

View File

@@ -334,7 +334,7 @@ class UIDefaultsLoader
if( newValue == null ) if( newValue == null )
throw new IllegalArgumentException( "variable '" + value + "' not found" ); throw new IllegalArgumentException( "variable '" + value + "' not found" );
return newValue; return resolveValueFromUIManager( newValue );
} }
if( !value.startsWith( PROPERTY_PREFIX ) ) if( !value.startsWith( PROPERTY_PREFIX ) )

View File

@@ -29,6 +29,7 @@ import javax.swing.table.JTableHeader;
import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import com.formdev.flatlaf.FlatLaf;
import com.formdev.flatlaf.icons.*; import com.formdev.flatlaf.icons.*;
import com.formdev.flatlaf.util.ColorFunctions; import com.formdev.flatlaf.util.ColorFunctions;
@@ -39,12 +40,20 @@ public class TestFlatStyling
{ {
@BeforeAll @BeforeAll
static void setup() { static void setup() {
HashMap<String, String> globalExtraDefaults = new HashMap<>();
globalExtraDefaults.put( "@var1", "#f00" );
globalExtraDefaults.put( "@var2", "@var1" );
globalExtraDefaults.put( "var2Resolved", "@var2" );
FlatLaf.setGlobalExtraDefaults( globalExtraDefaults );
TestUtils.setup( false ); TestUtils.setup( false );
} }
@AfterAll @AfterAll
static void cleanup() { static void cleanup() {
TestUtils.cleanup(); TestUtils.cleanup();
FlatLaf.setGlobalExtraDefaults( null );
} }
@Test @Test
@@ -171,6 +180,13 @@ public class TestFlatStyling
"saturate(darken(@background,20%),10%)" ); "saturate(darken(@background,20%),10%)" );
} }
@Test
void parseRecursiveVariables() {
Color background = UIManager.getColor( "var2Resolved" );
testColorStyle( background.getRGB(), "@var2" );
}
private void testColorStyle( int expectedRGB, String style ) { private void testColorStyle( int expectedRGB, String style ) {
testStyle( "background", new Color( expectedRGB, (expectedRGB & 0xff000000) != 0 ), style ); testStyle( "background", new Color( expectedRGB, (expectedRGB & 0xff000000) != 0 ), style );
} }

View File

@@ -18,7 +18,7 @@
// For maven compatibility, <font-version> should be in format <major>.<minor>[.<micro>]. // For maven compatibility, <font-version> should be in format <major>.<minor>[.<micro>].
// <build-number> is optional and should be incremented only if a new release is // <build-number> is optional and should be incremented only if a new release is
// necessary, but the <font-version> has not changed. // necessary, but the <font-version> has not changed.
version = "2.242" version = "2.304"
if( !rootProject.hasProperty( "release" ) ) if( !rootProject.hasProperty( "release" ) )
version = version.toString() + "-SNAPSHOT" version = version.toString() + "-SNAPSHOT"

View File

@@ -1,8 +1,8 @@
Copyright 2020 The JetBrains Mono Project Authors (https://github.com/JetBrains/JetBrainsMono) Copyright 2020 The JetBrains Mono Project Authors (https://github.com/JetBrains/JetBrainsMono)
This Font Software is licensed under the SIL Open Font License, Version 1.1. This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
This license is copied below, and is also available with a FAQ at: https://scripts.sil.org/OFL https://scripts.sil.org/OFL
----------------------------------------------------------- -----------------------------------------------------------