feat: 数据别名.

This commit is contained in:
lijiahang
2023-12-18 18:55:21 +08:00
parent 7be48c3774
commit b49791e860
25 changed files with 931 additions and 88 deletions

View File

@@ -36,10 +36,13 @@ public class HostSshConfigStrategy implements HostConfigStrategy<HostSshConfigMo
private static final int SSH_PORT = 22;
private static final String USERNAME = "root";
@Override
public HostSshConfigModel getDefault() {
return HostSshConfigModel.builder()
.port(SSH_PORT)
.username(USERNAME)
.charset(Const.UTF_8)
.connectTimeout(Const.MS_S_10)
.fileNameCharset(Const.UTF_8)

View File

@@ -48,7 +48,7 @@ public class TerminalThemeFetcher {
.limit(200)
.map(f -> {
JSONObject schema = JSONObject.parseObject(new String(FileReaders.readAllBytes(f)));
schema.put("dark", isDarkColor(schema.getString("background")));
schema.put("dark", Colors.isDarkColor(schema.getString("background")));
schema.put("selectionBackground", schema.getString("selection"));
// 转为对象
return JSON.parseObject(JSON.toJSONString(schema, colorFilter), TerminalTheme.class);
@@ -69,19 +69,6 @@ public class TerminalThemeFetcher {
System.out.println("\n\njsCode 已复制到剪切板");
}
/**
* TODO kit
* 是否为深色
* 亮度值 < 128 ? 深色 : 128
*
* @param hex hex
* @return 是否为深色
*/
public static boolean isDarkColor(String hex) {
int[] rgb = Colors.toRgbColor(hex);
return (rgb[0] * 299 + rgb[1] * 587 + rgb[2] * 114) / 1000 < 128;
}
//
/*
var term = new Terminal();