mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
introduce named colors in JBColor
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
package com.intellij.ui;
|
||||
|
||||
import com.intellij.util.NotNullProducer;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
import com.intellij.util.containers.hash.HashMap;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -43,6 +44,21 @@ public class JBColor extends Color {
|
||||
func = function;
|
||||
}
|
||||
|
||||
public static JBColor namedColor(@NotNull String propertyName, int defaultValueRGB) {
|
||||
return namedColor(propertyName, new Color(defaultValueRGB));
|
||||
}
|
||||
|
||||
|
||||
public static JBColor namedColor(@NotNull final String propertyName, @NotNull final Color defaultColor) {
|
||||
return new JBColor(new NotNullProducer<Color>() {
|
||||
@NotNull
|
||||
@Override
|
||||
public Color produce() {
|
||||
return ObjectUtils.notNull(UIManager.getColor(propertyName), defaultColor);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Color link() {
|
||||
return new JBColor(new NotNullProducer<Color>() {
|
||||
|
||||
Reference in New Issue
Block a user