mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-14 07:47:12 -06:00
FlatSVGIcon: use fluent API for color filter
This commit is contained in:
@@ -608,12 +608,13 @@ public class FlatSVGIcon
|
|||||||
/**
|
/**
|
||||||
* Adds color mappings. Used for light and dark themes.
|
* Adds color mappings. Used for light and dark themes.
|
||||||
*/
|
*/
|
||||||
public void addAll( Map<Color, Color> from2toMap ) {
|
public ColorFilter addAll( Map<Color, Color> from2toMap ) {
|
||||||
ensureColorMap();
|
ensureColorMap();
|
||||||
|
|
||||||
colorMap.putAll( from2toMap );
|
colorMap.putAll( from2toMap );
|
||||||
if( darkColorMap != null )
|
if( darkColorMap != null )
|
||||||
darkColorMap.putAll( from2toMap );
|
darkColorMap.putAll( from2toMap );
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -621,23 +622,25 @@ public class FlatSVGIcon
|
|||||||
*
|
*
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
*/
|
*/
|
||||||
public void addAll( Map<Color, Color> from2toLightMap, Map<Color, Color> from2toDarkMap ) {
|
public ColorFilter addAll( Map<Color, Color> from2toLightMap, Map<Color, Color> from2toDarkMap ) {
|
||||||
ensureColorMap();
|
ensureColorMap();
|
||||||
ensureDarkColorMap();
|
ensureDarkColorMap();
|
||||||
|
|
||||||
colorMap.putAll( from2toLightMap );
|
colorMap.putAll( from2toLightMap );
|
||||||
darkColorMap.putAll( from2toDarkMap );
|
darkColorMap.putAll( from2toDarkMap );
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a color mapping. Used for light and dark themes.
|
* Adds a color mapping. Used for light and dark themes.
|
||||||
*/
|
*/
|
||||||
public void add( Color from, Color to ) {
|
public ColorFilter add( Color from, Color to ) {
|
||||||
ensureColorMap();
|
ensureColorMap();
|
||||||
|
|
||||||
colorMap.put( from, to );
|
colorMap.put( from, to );
|
||||||
if( darkColorMap != null )
|
if( darkColorMap != null )
|
||||||
darkColorMap.put( from, to );
|
darkColorMap.put( from, to );
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -645,7 +648,7 @@ public class FlatSVGIcon
|
|||||||
*
|
*
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
*/
|
*/
|
||||||
public void add( Color from, Color toLight, Color toDark ) {
|
public ColorFilter add( Color from, Color toLight, Color toDark ) {
|
||||||
ensureColorMap();
|
ensureColorMap();
|
||||||
ensureDarkColorMap();
|
ensureDarkColorMap();
|
||||||
|
|
||||||
@@ -653,16 +656,18 @@ public class FlatSVGIcon
|
|||||||
colorMap.put( from, toLight );
|
colorMap.put( from, toLight );
|
||||||
if( toDark != null )
|
if( toDark != null )
|
||||||
darkColorMap.put( from, toDark );
|
darkColorMap.put( from, toDark );
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes a specific color mapping.
|
* Removes a specific color mapping.
|
||||||
*/
|
*/
|
||||||
public void remove( Color from ) {
|
public ColorFilter remove( Color from ) {
|
||||||
if( colorMap != null )
|
if( colorMap != null )
|
||||||
colorMap.remove( from );
|
colorMap.remove( from );
|
||||||
if( darkColorMap != null )
|
if( darkColorMap != null )
|
||||||
darkColorMap.remove( from );
|
darkColorMap.remove( from );
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -670,9 +675,10 @@ public class FlatSVGIcon
|
|||||||
*
|
*
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
*/
|
*/
|
||||||
public void removeAll() {
|
public ColorFilter removeAll() {
|
||||||
colorMap = null;
|
colorMap = null;
|
||||||
darkColorMap = null;
|
darkColorMap = null;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ensureColorMap() {
|
private void ensureColorMap() {
|
||||||
|
|||||||
Reference in New Issue
Block a user