Browse Source
Merge in DESIGN/design from ~KERRY/design_10.0:feature/x to feature/x * commit '562d3fc7231432d2f40fccef44e81e2d15f6c9b9': 开放接口给插件注册 代码修改 REPORT-144782【主题二期-取色器优化】【设计变动】衍生规则改变,后台适配feature/x
6 changed files with 130 additions and 105 deletions
@ -0,0 +1,32 @@ |
|||||||
|
package com.fr.design.style.color; |
||||||
|
|
||||||
|
import java.awt.Color; |
||||||
|
|
||||||
|
/** |
||||||
|
* 颜色选择器中单元颜色具体配置 |
||||||
|
*/ |
||||||
|
public class ColorConfig { |
||||||
|
private boolean supportTheme; |
||||||
|
private DeriveAlgorithm algorithm; |
||||||
|
|
||||||
|
private ColorConfig(boolean supportTheme, DeriveAlgorithm algorithm) { |
||||||
|
this.supportTheme = supportTheme; |
||||||
|
this.algorithm = algorithm; |
||||||
|
} |
||||||
|
|
||||||
|
public static ColorConfig createThemeColorConfig(DeriveAlgorithm deriveAlgorithm) { |
||||||
|
return new ColorConfig(true, deriveAlgorithm); |
||||||
|
} |
||||||
|
|
||||||
|
public static ColorConfig createThemeColorConfig(boolean supportTheme, DeriveAlgorithm deriveAlgorithm) { |
||||||
|
return new ColorConfig(supportTheme, deriveAlgorithm); |
||||||
|
} |
||||||
|
|
||||||
|
public boolean isSupportTheme() { |
||||||
|
return supportTheme; |
||||||
|
} |
||||||
|
|
||||||
|
public Color[] getDeriveColorArr(Color color, int defaultDeriveCount) { |
||||||
|
return algorithm.getDeriveColorArr(color, defaultDeriveCount); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,10 @@ |
|||||||
|
package com.fr.design.style.color; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* 颜色选择器风格 |
||||||
|
*/ |
||||||
|
public interface ColorSelectorStyle { |
||||||
|
List<ColorConfig> getColorConfigs(); |
||||||
|
} |
@ -0,0 +1,28 @@ |
|||||||
|
package com.fr.design.style.color; |
||||||
|
|
||||||
|
import com.fr.base.theme.FineColorDeriveState; |
||||||
|
|
||||||
|
import java.awt.Color; |
||||||
|
|
||||||
|
public interface DeriveAlgorithm { |
||||||
|
/** |
||||||
|
* 通用的衍生规则 |
||||||
|
*/ |
||||||
|
DeriveAlgorithm PLAIN_ALGORITHM = new DeriveAlgorithm() { |
||||||
|
@Override |
||||||
|
public Color[] getDeriveColorArr(Color color, int defaultDeriveCount) { |
||||||
|
return FineColorDeriveState.getDeriveColorArr(color, false, defaultDeriveCount); |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
/** |
||||||
|
* 默认的衍生规则,主要针对字体和背景 |
||||||
|
*/ |
||||||
|
DeriveAlgorithm DEFAULT_DERIVE_ALGORITHM = new DeriveAlgorithm() { |
||||||
|
public Color[] getDeriveColorArr(Color color, int defaultDeriveCount) { |
||||||
|
return FineColorDeriveState.getDeriveColorArr(color, true, defaultDeriveCount); |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
Color[] getDeriveColorArr(Color color, int defaultDeriveCount); |
||||||
|
} |
@ -0,0 +1,34 @@ |
|||||||
|
package com.fr.design.style.color; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
public class FRColorSelectorStyle implements ColorSelectorStyle { |
||||||
|
private static class Holder { |
||||||
|
private static final FRColorSelectorStyle INSTANCE = new FRColorSelectorStyle(); |
||||||
|
} |
||||||
|
|
||||||
|
public static FRColorSelectorStyle getInstance() { |
||||||
|
return FRColorSelectorStyle.Holder.INSTANCE; |
||||||
|
} |
||||||
|
|
||||||
|
private FRColorSelectorStyle() { |
||||||
|
} |
||||||
|
|
||||||
|
public List<ColorConfig> getColorConfigs() { |
||||||
|
ArrayList<ColorConfig> colorConfigs = new ArrayList<>(); |
||||||
|
// 8列主题色
|
||||||
|
colorConfigs.add(ColorConfig.createThemeColorConfig(DeriveAlgorithm.PLAIN_ALGORITHM)); |
||||||
|
colorConfigs.add(ColorConfig.createThemeColorConfig(DeriveAlgorithm.PLAIN_ALGORITHM)); |
||||||
|
colorConfigs.add(ColorConfig.createThemeColorConfig(DeriveAlgorithm.PLAIN_ALGORITHM)); |
||||||
|
colorConfigs.add(ColorConfig.createThemeColorConfig(DeriveAlgorithm.PLAIN_ALGORITHM)); |
||||||
|
colorConfigs.add(ColorConfig.createThemeColorConfig(DeriveAlgorithm.PLAIN_ALGORITHM)); |
||||||
|
colorConfigs.add(ColorConfig.createThemeColorConfig(DeriveAlgorithm.PLAIN_ALGORITHM)); |
||||||
|
colorConfigs.add(ColorConfig.createThemeColorConfig(DeriveAlgorithm.PLAIN_ALGORITHM)); |
||||||
|
colorConfigs.add(ColorConfig.createThemeColorConfig(DeriveAlgorithm.PLAIN_ALGORITHM)); |
||||||
|
// 2列灰度色
|
||||||
|
colorConfigs.add(ColorConfig.createThemeColorConfig(false, DeriveAlgorithm.DEFAULT_DERIVE_ALGORITHM)); |
||||||
|
colorConfigs.add(ColorConfig.createThemeColorConfig(false, DeriveAlgorithm.DEFAULT_DERIVE_ALGORITHM)); |
||||||
|
return colorConfigs; |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue