add "success" border color

fix #945
This commit is contained in:
Valery Semenchuk
2025-03-08 14:57:06 +04:00
parent 411a2f6d29
commit 86a4d0ab12
6 changed files with 73 additions and 30 deletions

View File

@@ -226,6 +226,13 @@ public interface FlatClientProperties
*/
String OUTLINE = "JComponent.outline";
/**
* Paint the component border in another color (usually greenish) to indicate an success.
*
* @see #OUTLINE
*/
String OUTLINE_SUCCESS = "success";
/**
* Paint the component border in another color (usually reddish) to indicate an error.
*

View File

@@ -55,6 +55,8 @@ import com.formdev.flatlaf.util.DerivedColor;
* @uiDefault Component.disabledBorderColor Color
* @uiDefault Component.focusedBorderColor Color
*
* @uiDefault Component.success.borderColor Color
* @uiDefault Component.success.focusedBorderColor Color
* @uiDefault Component.error.borderColor Color
* @uiDefault Component.error.focusedBorderColor Color
* @uiDefault Component.warning.borderColor Color
@@ -77,6 +79,8 @@ public class FlatBorder
@Styleable protected Color disabledBorderColor = UIManager.getColor( "Component.disabledBorderColor" );
@Styleable protected Color focusedBorderColor = UIManager.getColor( "Component.focusedBorderColor" );
@Styleable(dot=true) protected Color successBorderColor = UIManager.getColor( "Component.success.borderColor" );
@Styleable(dot=true) protected Color successFocusedBorderColor = UIManager.getColor( "Component.success.focusedBorderColor" );
@Styleable(dot=true) protected Color errorBorderColor = UIManager.getColor( "Component.error.borderColor" );
@Styleable(dot=true) protected Color errorFocusedBorderColor = UIManager.getColor( "Component.error.focusedBorderColor" );
@Styleable(dot=true) protected Color warningBorderColor = UIManager.getColor( "Component.warning.borderColor" );
@@ -163,6 +167,9 @@ public class FlatBorder
if( outline instanceof String ) {
switch( (String) outline ) {
case FlatClientProperties.OUTLINE_SUCCESS:
return isFocused( c ) ? successFocusedBorderColor : successBorderColor;
case FlatClientProperties.OUTLINE_ERROR:
return isFocused( c ) ? errorFocusedBorderColor : errorBorderColor;

View File

@@ -183,6 +183,8 @@ Component.linkColor = @accentLinkColor
Component.accentColor = if(@accentColor, @accentColor, @accentBaseColor)
Component.grayFilter = -20,-70,100
Component.success.borderColor = desaturate($Component.success.focusedBorderColor,25%)
Component.success.focusedBorderColor = #648b3c
Component.error.borderColor = desaturate($Component.error.focusedBorderColor,25%)
Component.error.focusedBorderColor = #8b3c3c
Component.warning.borderColor = darken(desaturate($Component.warning.focusedBorderColor,20%),10%)

View File

@@ -190,6 +190,8 @@ Component.linkColor = @accentLinkColor
Component.accentColor = if(@accentColor, @accentColor, @accentBaseColor)
Component.grayFilter = 25,-25,100
Component.success.borderColor = lighten(desaturate($Component.success.focusedBorderColor,20%),25%)
Component.success.focusedBorderColor = #14dc92
Component.error.borderColor = lighten(desaturate($Component.error.focusedBorderColor,20%),25%)
Component.error.focusedBorderColor = #e53e4d
Component.warning.borderColor = lighten(saturate($Component.warning.focusedBorderColor,25%),20%)