|
|
|
@ -4,6 +4,7 @@ import com.fr.base.FineColor;
|
|
|
|
|
import com.fr.base.theme.FineColorDeriveState; |
|
|
|
|
import com.fr.base.theme.TemplateTheme; |
|
|
|
|
import com.fr.design.DesignerEnvManager; |
|
|
|
|
import com.fr.design.base.mode.DesignModeContext; |
|
|
|
|
import com.fr.design.border.UIRoundedBorder; |
|
|
|
|
import com.fr.design.constants.UIConstants; |
|
|
|
|
import com.fr.design.dialog.BasicPane; |
|
|
|
@ -60,6 +61,8 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
|
|
|
|
|
private final JPanel menuColorPane; |
|
|
|
|
private ColorCell[][] themeColorCellGrid; |
|
|
|
|
|
|
|
|
|
private ColorSelectorStyle colorSelector; |
|
|
|
|
|
|
|
|
|
public static NewColorSelectPane createColorSelectPaneWithTheme(boolean supportTheme) { |
|
|
|
|
return new NewColorSelectPane(true, supportTheme); |
|
|
|
|
} |
|
|
|
@ -156,6 +159,7 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
|
|
|
|
|
JPanel centerPane = new JPanel(new GridLayout(1, 8, DEFAULT_COLOR_HOR_INTERVAL, 0)); |
|
|
|
|
menuColorPane.add(northPane, BorderLayout.NORTH); |
|
|
|
|
menuColorPane.add(centerPane, BorderLayout.CENTER); |
|
|
|
|
this.colorSelector = DesignModeContext.isDuchampMode() ? ColorSelectorStyle.FVS : ColorSelectorStyle.FR; |
|
|
|
|
|
|
|
|
|
Color[] colorArray = new Color[]{ |
|
|
|
|
// 8列主题色
|
|
|
|
@ -177,11 +181,11 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
|
|
|
|
|
themeColorCellGrid = new ColorCell[colorArray.length][DEFAULT_DERIVE_COUNT]; |
|
|
|
|
for (int i = 0; i < colorArray.length; i++) { |
|
|
|
|
ColorCell[] colorCellColumn = new ColorCell[DEFAULT_DERIVE_COUNT]; |
|
|
|
|
boolean isDefaultColor = (i == colorArray.length - 1 || i == colorArray.length - 2); |
|
|
|
|
ColorConfig colorConfig = colorSelector.getColorConfig(i); |
|
|
|
|
Color color = colorArray[i]; |
|
|
|
|
Color[] deriveColorArr = FineColorDeriveState.getDeriveColorArr(color, isDefaultColor, DEFAULT_DERIVE_COUNT); |
|
|
|
|
Color[] deriveColorArr = colorConfig.getDeriveColorArr(color, DEFAULT_DERIVE_COUNT); |
|
|
|
|
for (int j = 0; j < deriveColorArr.length; j++) { |
|
|
|
|
colorCellColumn[j] = createFineColorCell(deriveColorArr[j], isDefaultColor, i, j); |
|
|
|
|
colorCellColumn[j] = createFineColorCell(deriveColorArr[j], !colorConfig.supportTheme, i, j); |
|
|
|
|
} |
|
|
|
|
themeColorCellGrid[i] = colorCellColumn; |
|
|
|
|
} |
|
|
|
@ -215,13 +219,13 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (standardColors == null || standardColors.size() < 8) { |
|
|
|
|
if (standardColors == null || standardColors.size() < 8 || standardColors.size() > 10) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (int i = 0; i < themeColorCellGrid.length - 2; i++) { |
|
|
|
|
Color color = standardColors.get(i); |
|
|
|
|
Color[] deriveColorArr = FineColorDeriveState.getDeriveColorArr(color, false, DEFAULT_DERIVE_COUNT); |
|
|
|
|
for (int i = 0; i < standardColors.size(); i++) { |
|
|
|
|
Color standardColor = standardColors.get(i); |
|
|
|
|
ColorConfig colorConfig = colorSelector.getColorConfig(i); |
|
|
|
|
Color[] deriveColorArr = colorConfig.getDeriveColorArr(standardColor, DEFAULT_DERIVE_COUNT); |
|
|
|
|
for (int j = 0; j < deriveColorArr.length; j++) { |
|
|
|
|
themeColorCellGrid[i][j].setColor(deriveColorArr[j]); |
|
|
|
|
} |
|
|
|
@ -447,5 +451,90 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private enum DeriveAlgorithm { |
|
|
|
|
PLAIN_ALGORITHM { |
|
|
|
|
public Color[] getDeriveColorArr(Color color, int defaultDeriveCount) { |
|
|
|
|
return FineColorDeriveState.getDeriveColorArr(color, false, defaultDeriveCount); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
DEFAULT_DERIVE_ALGORITHM { |
|
|
|
|
public Color[] getDeriveColorArr(Color color, int defaultDeriveCount) { |
|
|
|
|
return FineColorDeriveState.getDeriveColorArr(color, true, defaultDeriveCount); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
public abstract Color[] getDeriveColorArr(Color color, int defaultDeriveCount); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static 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 Color[] getDeriveColorArr(Color color, int defaultDeriveCount){ |
|
|
|
|
return algorithm.getDeriveColorArr(color, defaultDeriveCount); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private enum ColorSelectorStyle { |
|
|
|
|
FR, |
|
|
|
|
FVS { |
|
|
|
|
public List<ColorConfig> getColorConfigs() { |
|
|
|
|
ArrayList<ColorConfig> colorConfigs = new ArrayList<>(); |
|
|
|
|
colorConfigs.add(ColorConfig.createThemeColorConfig(DeriveAlgorithm.DEFAULT_DERIVE_ALGORITHM)); |
|
|
|
|
colorConfigs.add(ColorConfig.createThemeColorConfig(DeriveAlgorithm.DEFAULT_DERIVE_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)); |
|
|
|
|
colorConfigs.add(ColorConfig.createThemeColorConfig(DeriveAlgorithm.PLAIN_ALGORITHM)); |
|
|
|
|
return colorConfigs; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
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; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public ColorConfig getColorConfig(int i) { |
|
|
|
|
List<ColorConfig> colorConfigs = getColorConfigs(); |
|
|
|
|
if (i < 0 || i > colorConfigs.size()) { |
|
|
|
|
return colorConfigs.get(0); |
|
|
|
|
} |
|
|
|
|
return colorConfigs.get(i); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|