Skip to content

Commit

Permalink
Merge branch 'test_sticker'
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentAzz committed Dec 24, 2024
2 parents 70fe0fd + a61092c commit c07dff4
Show file tree
Hide file tree
Showing 11 changed files with 29,983 additions and 29,949 deletions.
20 changes: 16 additions & 4 deletions .github/workflows/build_filled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,22 @@ on:
workflow_dispatch:
inputs:
fg_color:
description: '前景色FG_COLOR (线条颜色例如 #003a71)'
description: '前景色FG_COLOR (线条颜色, 例如 #003a71)'
required: true
default: '#003a71'
type: string
bg_color:
description: '背景色BG_COLOR (背景颜色例如 #a1cafe)'
description: '背景色BG_COLOR (背景颜色, 例如 #a1cafe)'
required: true
default: '#a1cafe'
type: string
fill_color:
description: '填充色FILL_COLOR (可选留空则自动计算)'
description: '填充色FILL_COLOR (可选, 留空则自动计算)'
required: false
default: ''
type: string
theme_name:
description: '颜色名称 (用于打包文件名显示,可选,例如: light_blue。默认留空)'
description: '颜色名称 (用于打包文件名显示, 可选, 例如: light_blue。默认留空)'
required: false
default: ''
type: string
Expand All @@ -40,6 +40,14 @@ on:
options:
- 'True'
- 'False'
enable_cache:
description: '是否启用填充区域缓存 (True/False)'
required: false
default: 'True'
type: choice
options:
- 'True'
- 'False'

jobs:
build:
Expand Down Expand Up @@ -75,6 +83,7 @@ jobs:
FILL_COLOR: ${{ inputs.fill_color }}
THEME_NAME: ${{ github.event_name == 'workflow_dispatch' && inputs.theme_name || '' }}
TEST_ENV: ${{ github.event_name == 'workflow_dispatch' && inputs.test_env || 'False' }}
ENABLE_CACHE: ${{ github.event_name == 'workflow_dispatch' && inputs.enable_cache || 'True' }}
run: |
CMD="python build_filled.py -fg \"$FG_COLOR\" -bg \"$BG_COLOR\""
if [ -n "$FILL_COLOR" ]; then
Expand All @@ -83,6 +92,9 @@ jobs:
if [ "${TEST_ENV,,}" = "true" ]; then
CMD="$CMD -test"
fi
if [ "${ENABLE_CACHE,,}" = "false" ]; then
CMD="$CMD -cache false"
fi
eval $CMD
- name: Prepare artifact
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build_outlined.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ on:
workflow_dispatch:
inputs:
fg_color:
description: '前景色FG_COLOR (图标颜色例如 #d1e2fc)'
description: '前景色FG_COLOR (图标颜色, 例如 #d1e2fc)'
required: true
default: '#d1e2fc'
type: string
bg_color:
description: '背景色BG_COLOR (背景颜色例如 #1c232b)'
description: '背景色BG_COLOR (背景颜色, 例如 #1c232b)'
required: true
default: '#1c232b'
type: string
theme_name:
description: '颜色名称将包含在输出文件名中 (可选例如: dark_blue)'
description: '颜色名称, 将包含在输出文件名中 (可选, 例如: dark_blue)'
required: false
default: ''
type: string
Expand Down
41 changes: 29 additions & 12 deletions build_filled.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,32 @@
def parse_args():
"""解析命令行参数
支持的参数:
-fg: 前景色,例如 "#003a71"
-bg: 背景色,例如 "#a1cafe"
-fill: 填充色,可选,默认自动计算
-test: 是否使用测试目录,默认False
支持的参数:
-fg: 前景色, 例如 "#003a71"
-bg: 背景色, 例如 "#a1cafe"
-fill: 填充色, 可选, 留空自动计算
-test: 是否使用测试目录, 默认False
-cache: 是否启用填充区域预计算缓存, 加速构建。默认True
Example:
使用test测试目录
python build_filled.py -fg "#003a71" -bg "#a1cafe" -fill "#e4f0fe" -test
使用Lawnicons生产目录
启用缓存, 指定填充颜色,使用生产目录:
python build_filled.py -fg "#003a71" -bg "#a1cafe" -fill "#003a71"
启用缓存, 不指定填充颜色, 使用生产目录:
python build_filled.py -fg "#003a71" -bg "#a1cafe"
禁用缓存, 不指定填充颜色, 使用测试目录:
python build_filled.py -fg "#003a71" -bg "#a1cafe" -cache false -test
启用缓存, 不指定填充颜色, 使用测试目录:
python build_filled.py -fg "#003a71" -bg "#a1cafe" -test
"""
parser = argparse.ArgumentParser(description="构建Fill风格图标")
parser.add_argument("-fg", type=str, help="前景色 (例如: #000000)")
parser.add_argument("-bg", type=str, help="背景色 (例如: #ffffff)")
parser.add_argument("-fill", type=str, help="填充色,可选,默认自动计算")
parser.add_argument("-fill", type=str, help="填充色, 可选, 留空自动计算")
parser.add_argument("-test", action="store_true", help="使用测试目录")
parser.add_argument(
"-cache", type=str, default="true", help="是否启用填充区域预计算缓存 (true/false)"
)
return parser.parse_args()


Expand Down Expand Up @@ -144,7 +153,7 @@ def build_filled(test_env: bool):

# 运行后清理
print("\n(6/6) Cleaner: 运行后清理")
# Cleaner.cleanup(CleanConfig.clean_up)
Cleaner.cleanup(CleanConfig.clean_up)

print("\n处理完成, 工件已保存至当前目录")
print("刷入后请重启设备")
Expand All @@ -161,7 +170,6 @@ def build_filled(test_env: bool):

if __name__ == "__main__":
args = parse_args()
# 优先使用命令行参数,其次使用环境变量
if args.fg:
IconConfig.fg_color = args.fg
elif os.getenv("FG_COLOR"):
Expand All @@ -175,4 +183,13 @@ def build_filled(test_env: bool):
if args.fill:
os.environ["FILL_COLOR"] = args.fill

build_filled(args.test or os.getenv("TEST_ENV", "False").lower() == "true")
# 是否使用缓存
PerformanceConfig.enable_fill_mask_cache = (
args.cache.lower() == "true"
if args.cache
else os.getenv("ENABLE_CACHE", "true").lower() == "true"
)

# 是否使用测试目录
test_env = args.test or os.getenv("TEST_ENV", "False").lower() == "true"
build_filled(test_env=test_env)
20 changes: 11 additions & 9 deletions build_outlined.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@
def parse_args():
"""解析命令行参数
支持的参数
-fg: 前景色例如 "#003a71"
-bg: 背景色例如 "#a1cafe"
-test: 是否使用测试目录默认False
支持的参数:
-fg: 前景色, 例如 "#003a71"
-bg: 背景色, 例如 "#a1cafe"
-test: 是否使用测试目录, 默认False
Example:
使用test测试目录
python build_outlined.py -fg "#003a71" -bg "#a1cafe" -test
使用Lawnicons生产目录
使用生产目录:
python build_outlined.py -fg "#003a71" -bg "#a1cafe"
使用测试目录:
python build_outlined.py -fg "#003a71" -bg "#a1cafe" -test
"""
parser = argparse.ArgumentParser(description='构建Outlined风格图标')
parser.add_argument('-fg', type=str, help='前景色 (例如: "#003a71")')
Expand Down Expand Up @@ -147,7 +147,7 @@ def build_outlined(test_env: bool):
if __name__ == "__main__":
args = parse_args()

# 优先使用命令行参数其次使用环境变量
# 优先使用命令行参数, 其次使用环境变量
if args.fg:
IconConfig.fg_color = args.fg
elif os.getenv("FG_COLOR"):
Expand All @@ -158,4 +158,6 @@ def build_outlined(test_env: bool):
elif os.getenv("BG_COLOR"):
IconConfig.bg_color = os.getenv("BG_COLOR")

build_outlined(args.test or os.getenv("TEST_ENV", "False").lower() == "true")
# 是否使用测试目录
test_env = args.test or os.getenv("TEST_ENV", "False").lower() == "true"
build_outlined(test_env=test_env)
Binary file modified cached_masks.tar.lz4
Binary file not shown.
Loading

0 comments on commit c07dff4

Please sign in to comment.