mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-09 16:25:10 +03:00
fixed Swing system colors in dark themes
This commit is contained in:
@@ -13,6 +13,7 @@ FlatLaf Change Log
|
|||||||
- Button: Fixed help button styling in IntelliJ platform themes.
|
- Button: Fixed help button styling in IntelliJ platform themes.
|
||||||
- ScrollPane: Paint disabled border if view component (e.g. JTextPane) is
|
- ScrollPane: Paint disabled border if view component (e.g. JTextPane) is
|
||||||
disabled.
|
disabled.
|
||||||
|
- Fixed Swing system colors in dark themes.
|
||||||
|
|
||||||
|
|
||||||
## 0.20
|
## 0.20
|
||||||
|
|||||||
@@ -54,14 +54,14 @@
|
|||||||
*.acceleratorSelectionForeground=@selectionForeground
|
*.acceleratorSelectionForeground=@selectionForeground
|
||||||
|
|
||||||
|
|
||||||
#---- system ----
|
#---- system colors ----
|
||||||
|
|
||||||
control=@background
|
activeCaption=#434E60
|
||||||
controlText=@foreground
|
inactiveCaption=#393C3D
|
||||||
infoText=@foreground
|
controlHighlight=#616669
|
||||||
text=@foreground
|
controlLtHighlight=#303234
|
||||||
textText=@foreground
|
controlShadow=#afb3b5
|
||||||
window=@background
|
controlDkShadow=#d7d9da
|
||||||
|
|
||||||
|
|
||||||
#---- Button ----
|
#---- Button ----
|
||||||
|
|||||||
@@ -61,6 +61,30 @@ ViewportUI=com.formdev.flatlaf.ui.FlatViewportUI
|
|||||||
@textComponentMargin=2,6,2,6
|
@textComponentMargin=2,6,2,6
|
||||||
|
|
||||||
|
|
||||||
|
#---- system colors ----
|
||||||
|
|
||||||
|
desktop=@textComponentBackground
|
||||||
|
activeCaptionText=@foreground
|
||||||
|
activeCaptionBorder=@@activeCaption
|
||||||
|
inactiveCaptionText=@foreground
|
||||||
|
inactiveCaptionBorder=@@inactiveCaption
|
||||||
|
window=@background
|
||||||
|
windowBorder=@foreground
|
||||||
|
windowText=@foreground
|
||||||
|
menu=@background
|
||||||
|
menuText=@foreground
|
||||||
|
text=@textComponentBackground
|
||||||
|
textText=@foreground
|
||||||
|
textHighlight=@selectionBackground
|
||||||
|
textHighlightText=@selectionForeground
|
||||||
|
textInactiveText=@disabledText
|
||||||
|
control=@background
|
||||||
|
controlText=@foreground
|
||||||
|
scrollbar=@@ScrollBar.track
|
||||||
|
info=@@ToolTip.background
|
||||||
|
infoText=@foreground
|
||||||
|
|
||||||
|
|
||||||
#---- Button ----
|
#---- Button ----
|
||||||
|
|
||||||
Button.border=com.formdev.flatlaf.ui.FlatButtonBorder
|
Button.border=com.formdev.flatlaf.ui.FlatButtonBorder
|
||||||
|
|||||||
@@ -54,14 +54,14 @@
|
|||||||
*.acceleratorSelectionForeground=@selectionForeground
|
*.acceleratorSelectionForeground=@selectionForeground
|
||||||
|
|
||||||
|
|
||||||
#---- system ----
|
#---- system colors ----
|
||||||
|
|
||||||
control=#e0e0e0
|
activeCaption=#99b4d1
|
||||||
controlText=@foreground
|
inactiveCaption=#bfcddb
|
||||||
infoText=@foreground
|
controlHighlight=#e3e3e3
|
||||||
text=@foreground
|
controlLtHighlight=#fff
|
||||||
textText=@foreground
|
controlShadow=#a0a0a0
|
||||||
window=@background
|
controlDkShadow=#696969
|
||||||
|
|
||||||
|
|
||||||
#---- Button ----
|
#---- Button ----
|
||||||
|
|||||||
@@ -0,0 +1,142 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 FormDev Software GmbH
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.formdev.flatlaf.testing;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
import javax.swing.*;
|
||||||
|
import net.miginfocom.swing.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Karl Tauber
|
||||||
|
*/
|
||||||
|
public class FlatSystemColorsTest
|
||||||
|
extends FlatTestPanel
|
||||||
|
{
|
||||||
|
public static void main( String[] args ) {
|
||||||
|
SwingUtilities.invokeLater( () -> {
|
||||||
|
FlatTestFrame frame = FlatTestFrame.create( args, "FlatSystemColorsTest" );
|
||||||
|
frame.showFrame( FlatSystemColorsTest::new );
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
|
FlatSystemColorsTest() {
|
||||||
|
initComponents();
|
||||||
|
|
||||||
|
String[] systemColors = {
|
||||||
|
"desktop",
|
||||||
|
"activeCaption",
|
||||||
|
"activeCaptionText",
|
||||||
|
"activeCaptionBorder",
|
||||||
|
"inactiveCaption",
|
||||||
|
"inactiveCaptionText",
|
||||||
|
"inactiveCaptionBorder",
|
||||||
|
"window",
|
||||||
|
"windowBorder",
|
||||||
|
"windowText",
|
||||||
|
"menu",
|
||||||
|
"menuText",
|
||||||
|
"text",
|
||||||
|
"textText",
|
||||||
|
"textHighlight",
|
||||||
|
"textHighlightText",
|
||||||
|
"textInactiveText",
|
||||||
|
"control",
|
||||||
|
"controlText",
|
||||||
|
"controlHighlight",
|
||||||
|
"controlLtHighlight",
|
||||||
|
"controlShadow",
|
||||||
|
"controlDkShadow",
|
||||||
|
"scrollbar",
|
||||||
|
"info",
|
||||||
|
"infoText",
|
||||||
|
};
|
||||||
|
|
||||||
|
for( String systemColor : systemColors ) {
|
||||||
|
systemColorsPanel.add( new JLabel( systemColor ) );
|
||||||
|
systemColorsPanel.add( new Preview( systemColor ), "wrap" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initComponents() {
|
||||||
|
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
|
||||||
|
systemColorsPanel = new JPanel();
|
||||||
|
|
||||||
|
//======== this ========
|
||||||
|
setLayout(new MigLayout(
|
||||||
|
"ltr,insets dialog,hidemode 3",
|
||||||
|
// columns
|
||||||
|
"[fill]",
|
||||||
|
// rows
|
||||||
|
"[grow,fill]"));
|
||||||
|
|
||||||
|
//======== systemColorsPanel ========
|
||||||
|
{
|
||||||
|
systemColorsPanel.setLayout(new MigLayout(
|
||||||
|
"hidemode 3",
|
||||||
|
// columns
|
||||||
|
"[fill]",
|
||||||
|
// rows
|
||||||
|
"[]"));
|
||||||
|
}
|
||||||
|
add(systemColorsPanel, "cell 0 0");
|
||||||
|
// JFormDesigner - End of component initialization //GEN-END:initComponents
|
||||||
|
}
|
||||||
|
|
||||||
|
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
|
||||||
|
private JPanel systemColorsPanel;
|
||||||
|
// JFormDesigner - End of variables declaration //GEN-END:variables
|
||||||
|
|
||||||
|
//---- class Preview ----
|
||||||
|
|
||||||
|
private static class Preview
|
||||||
|
extends JPanel
|
||||||
|
{
|
||||||
|
private final String colorKey;
|
||||||
|
private final JPanel colorPreview;
|
||||||
|
private final JLabel colorCode;
|
||||||
|
|
||||||
|
Preview( String colorKey ) {
|
||||||
|
super( new MigLayout( "ltr,insets 0", "[50,fill][]", "[fill]0" ) );
|
||||||
|
|
||||||
|
this.colorKey = colorKey;
|
||||||
|
|
||||||
|
colorPreview = new JPanel();
|
||||||
|
colorPreview.setOpaque( true );
|
||||||
|
colorCode = new JLabel();
|
||||||
|
|
||||||
|
add( colorPreview );
|
||||||
|
add( colorCode, "wrap" );
|
||||||
|
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateUI() {
|
||||||
|
super.updateUI();
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void update() {
|
||||||
|
if( colorKey == null )
|
||||||
|
return; // called from constructor
|
||||||
|
|
||||||
|
Color color = UIManager.getColor( colorKey );
|
||||||
|
colorPreview.setBackground( (color != null) ? new Color( color.getRGB(), true ) : null );
|
||||||
|
colorCode.setText( (color != null) ? String.format( "#%06x", color.getRGB() & 0xffffff ) : "-" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
JFDML JFormDesigner: "7.0.0.0.194" Java: "11.0.2" encoding: "UTF-8"
|
||||||
|
|
||||||
|
new FormModel {
|
||||||
|
contentType: "form/swing"
|
||||||
|
root: new FormRoot {
|
||||||
|
auxiliary() {
|
||||||
|
"JavaCodeGenerator.defaultVariableLocal": true
|
||||||
|
}
|
||||||
|
add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||||
|
"$layoutConstraints": "ltr,insets dialog,hidemode 3"
|
||||||
|
"$columnConstraints": "[fill]"
|
||||||
|
"$rowConstraints": "[grow,fill]"
|
||||||
|
} ) {
|
||||||
|
name: "this"
|
||||||
|
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||||
|
"$layoutConstraints": "hidemode 3"
|
||||||
|
"$columnConstraints": "[fill]"
|
||||||
|
"$rowConstraints": "[]"
|
||||||
|
} ) {
|
||||||
|
name: "systemColorsPanel"
|
||||||
|
auxiliary() {
|
||||||
|
"JavaCodeGenerator.variableLocal": false
|
||||||
|
}
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 0"
|
||||||
|
} )
|
||||||
|
}, new FormLayoutConstraints( null ) {
|
||||||
|
"location": new java.awt.Point( 0, 0 )
|
||||||
|
"size": new java.awt.Dimension( 415, 350 )
|
||||||
|
} )
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,6 +19,7 @@
|
|||||||
@background=#ccffcc
|
@background=#ccffcc
|
||||||
@foreground=#ff0000
|
@foreground=#ff0000
|
||||||
@selectionBackground=#00aa00
|
@selectionBackground=#00aa00
|
||||||
|
@selectionForeground=#ffff00
|
||||||
@selectionInactiveBackground=#888888
|
@selectionInactiveBackground=#888888
|
||||||
@selectionInactiveForeground=#ffffff
|
@selectionInactiveForeground=#ffffff
|
||||||
@disabledText=#000088
|
@disabledText=#000088
|
||||||
@@ -37,7 +38,7 @@
|
|||||||
*.inactiveBackground=#f0f0f0
|
*.inactiveBackground=#f0f0f0
|
||||||
*.inactiveForeground=#000088
|
*.inactiveForeground=#000088
|
||||||
*.selectionBackground=@selectionBackground
|
*.selectionBackground=@selectionBackground
|
||||||
*.selectionForeground=#ffff00
|
*.selectionForeground=@selectionForeground
|
||||||
*.disabledBackground=#e0e0e0
|
*.disabledBackground=#e0e0e0
|
||||||
*.disabledForeground=@disabledText
|
*.disabledForeground=@disabledText
|
||||||
*.disabledText=@disabledText
|
*.disabledText=@disabledText
|
||||||
@@ -45,6 +46,16 @@
|
|||||||
*.acceleratorSelectionForeground=#ffffff
|
*.acceleratorSelectionForeground=#ffffff
|
||||||
|
|
||||||
|
|
||||||
|
#---- system colors ----
|
||||||
|
|
||||||
|
activeCaption=#99b4d1
|
||||||
|
inactiveCaption=#bfcddb
|
||||||
|
controlHighlight=#e3e3e3
|
||||||
|
controlLtHighlight=#fff
|
||||||
|
controlShadow=#a0a0a0
|
||||||
|
controlDkShadow=#696969
|
||||||
|
|
||||||
|
|
||||||
#---- Button ----
|
#---- Button ----
|
||||||
|
|
||||||
Button.startBackground=#fff
|
Button.startBackground=#fff
|
||||||
|
|||||||
Reference in New Issue
Block a user