添加主题.

This commit is contained in:
lijiahangmax
2024-08-13 20:56:00 +08:00
parent 1066b43b3d
commit 4a91ec47bf
2 changed files with 18 additions and 11 deletions

View File

@@ -75,6 +75,10 @@ public class HostTerminalServiceImpl implements HostTerminalService {
@Override @Override
public List<HostTerminalThemeVO> getTerminalThemes() { public List<HostTerminalThemeVO> getTerminalThemes() {
// if (true) {
// String arr = "";
// return JSON.parseArray(arr, HostTerminalThemeVO.class);
// }
List<JSONObject> themes = dictValueApi.getDictValue(THEME_DICT_KEY); List<JSONObject> themes = dictValueApi.getDictValue(THEME_DICT_KEY);
return themes.stream() return themes.stream()
.map(s -> HostTerminalThemeVO.builder() .map(s -> HostTerminalThemeVO.builder()

View File

@@ -28,13 +28,15 @@ public class TerminalThemeGenerator {
List<File> files = Files1.listFiles("D:\\idea-project\\iTerm2-Color-Schemes\\vhs"); List<File> files = Files1.listFiles("D:\\idea-project\\iTerm2-Color-Schemes\\vhs");
// 过滤的 theme // 过滤的 theme
List<String> schemaFilter = Lists.of( List<String> schemaFilter = Lists.of(
"Dracula", "Atom", "Dracula", "Builtin Tango Light",
"catppuccin-mocha", "MaterialDesignColors", "Atom", "AtomOneLight",
"catppuccin-macchiato", "OneHalfDark", "OneHalfDark", "OneHalfLight",
"Apple System Colors", "Builtin Tango Light", "Apple System Colors", "Tomorrow",
"Duotone Dark", "BlulocoLight", "catppuccin-mocha", "catppuccin-latte",
"Chester", "CLRS", "catppuccin-macchiato", "BlulocoLight",
"Calamity", "Tomorrow" "catppuccin-frappe", "MaterialDesignColors",
"GitHub Dark", "Github",
"DimmedMonokai", "Duotone Dark"
); );
// 颜色大写 // 颜色大写
ValueFilter colorFilter = (Object object, String name, Object value) -> { ValueFilter colorFilter = (Object object, String name, Object value) -> {
@@ -60,7 +62,7 @@ public class TerminalThemeGenerator {
theme.setDark(Colors.isDarkColor(background)); theme.setDark(Colors.isDarkColor(background));
theme.setSchema(JSON.parseObject(JSON.toJSONString(schema), TerminalThemeSchema.class)); theme.setSchema(JSON.parseObject(JSON.toJSONString(schema), TerminalThemeSchema.class));
return theme; return theme;
}).collect(Collectors.toList()); }).skip(0).limit(50).collect(Collectors.toList());
// 排序 // 排序
if (!Lists.isEmpty(schemaFilter)) { if (!Lists.isEmpty(schemaFilter)) {
arr.sort(Comparator.comparing(s -> schemaFilter.indexOf(s.getName()))); arr.sort(Comparator.comparing(s -> schemaFilter.indexOf(s.getName())));
@@ -70,11 +72,12 @@ public class TerminalThemeGenerator {
for (TerminalTheme theme : arr) { for (TerminalTheme theme : arr) {
System.out.println("name: " + theme.name); System.out.println("name: " + theme.name);
System.out.println("dark: " + theme.dark); System.out.println("dark: " + theme.dark);
System.out.println("value: \n" + JSON.toJSONString(theme.schema, colorFilter)); System.out.println("value: " + JSON.toJSONString(theme.schema, colorFilter));
System.out.println("json: " + JSON.toJSONString(theme, colorFilter));
System.out.println(); System.out.println();
} }
// String json = JSON.toJSONString(arr, colorFilter); String json = JSON.toJSONString(arr, colorFilter);
// System.out.println("\n" + json); System.out.println("\n" + json);
} }
/* /*