@kecan0406/ttheme 1.2.7 → 1.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -7
- package/bin/ttheme.js +225 -207
- package/bin/ttheme.js.map +1 -1
- package/dist/manifest.json +1 -1
- package/package.json +2 -2
- package/shell/adapters/_bg.zsh +21 -9
- package/shell/ttheme.zsh +842 -199
package/dist/manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kecan0406/ttheme",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"ttheme": "bin/ttheme.js"
|
|
@@ -34,12 +34,12 @@
|
|
|
34
34
|
"@biomejs/biome": "^2.3.0",
|
|
35
35
|
"@clack/core": "^1.4.3",
|
|
36
36
|
"@clack/prompts": "^1.7.0",
|
|
37
|
+
"@jsquash/jpeg": "^1.6.0",
|
|
37
38
|
"@material/material-color-utilities": "^0.4.0",
|
|
38
39
|
"@types/bun": "^1.3.0",
|
|
39
40
|
"@types/pngjs": "6.0.5",
|
|
40
41
|
"@xterm/headless": "6.0.0",
|
|
41
42
|
"fast-string-width": "^3.0.2",
|
|
42
|
-
"jpeg-js": "^0.4.4",
|
|
43
43
|
"pngjs": "7.0.0",
|
|
44
44
|
"smol-toml": "^1.9.0",
|
|
45
45
|
"typescript": "^5.8.2"
|
package/shell/adapters/_bg.zsh
CHANGED
|
@@ -506,6 +506,19 @@ __tt_pv_img() {
|
|
|
506
506
|
[[ -z $2 || $2 == "${bgact[$1]}" ]] || REPLY=$1:$2
|
|
507
507
|
}
|
|
508
508
|
|
|
509
|
+
__tt_pv_bg_prepare() {
|
|
510
|
+
local key=${tpick##*:} want REPLY
|
|
511
|
+
[[ $tpick == *:* ]] || key=${bgact[$tune]}
|
|
512
|
+
[[ -n $key ]] || return 0
|
|
513
|
+
__tt_bg_coloring $tpick
|
|
514
|
+
want=$tune:$key:$REPLY
|
|
515
|
+
(( ${+bgprep[$want]} )) && return 0
|
|
516
|
+
(( bgprepid )) && kill -0 $bgprepid 2>/dev/null && return 0
|
|
517
|
+
bgprep[$want]=1
|
|
518
|
+
__tt_cli image $tune prepare $key </dev/null >/dev/null 2>&1 &!
|
|
519
|
+
bgprepid=$!
|
|
520
|
+
}
|
|
521
|
+
|
|
509
522
|
__tt_pv_tune_open() {
|
|
510
523
|
local REPLY
|
|
511
524
|
__tt_bg_load $1
|
|
@@ -513,6 +526,7 @@ __tt_pv_tune_open() {
|
|
|
513
526
|
tpick=$REPLY tune=$1 tf=1 tsnaps=()
|
|
514
527
|
__tt_bg_load $tpick
|
|
515
528
|
tsnaps[$tpick]="${bgsize[$tpick]} ${bgpos[$tpick]} ${bgop[$tpick]} ${bgoff[$tpick]}"
|
|
529
|
+
__tt_pv_bg_prepare
|
|
516
530
|
}
|
|
517
531
|
|
|
518
532
|
__tt_pv_bg_pick() {
|
|
@@ -532,6 +546,7 @@ __tt_pv_bg_pick() {
|
|
|
532
546
|
__tt_bg_load $tpick
|
|
533
547
|
(( ${+tsnaps[$tpick]} )) || tsnaps[$tpick]="${bgsize[$tpick]} ${bgpos[$tpick]} ${bgop[$tpick]} ${bgoff[$tpick]}"
|
|
534
548
|
bgname=""
|
|
549
|
+
__tt_pv_bg_prepare
|
|
535
550
|
}
|
|
536
551
|
|
|
537
552
|
__tt_pv_bg_drop() {
|
|
@@ -560,14 +575,13 @@ __tt_pv_bg_recolor() {
|
|
|
560
575
|
__tt_bg_coloring $tpick
|
|
561
576
|
want=original
|
|
562
577
|
[[ $REPLY == original ]] && want=tone
|
|
563
|
-
__tt_pv_tune_keep
|
|
564
|
-
__tt_pv_bg_commit $name
|
|
565
578
|
msg="Drawing in its own colors"
|
|
566
579
|
[[ $want == tone ]] && msg="Drawing in the palette's tone"
|
|
567
580
|
msgt=300
|
|
568
581
|
printf '\e[?2026h'
|
|
569
582
|
__tt_pv_draw
|
|
570
|
-
|
|
583
|
+
__tt_pv_tune_stage
|
|
584
|
+
__tt_pv_bg_commit $name
|
|
571
585
|
err=$(__tt_cli image $name $want $key 2>&1)
|
|
572
586
|
rc=$?
|
|
573
587
|
err=${${err//$'\n'/ }## #}
|
|
@@ -577,6 +591,7 @@ __tt_pv_bg_recolor() {
|
|
|
577
591
|
bgload[$name]="" bgedit[$name]=1
|
|
578
592
|
msg=${err:-"Background · $name"} msgt=$(( rc ? 300 : 200 ))
|
|
579
593
|
[[ -r ${TTHEME_CONFIG:h}/backgrounds/${${name/@/--}/\//--}.conf ]] || return 0
|
|
594
|
+
(( rc )) || bgprep[$name:$key:$want]=1
|
|
580
595
|
__tt_pv_tune_open $name
|
|
581
596
|
if [[ $was != "$tpick" ]]; then
|
|
582
597
|
tpick=$was
|
|
@@ -588,7 +603,7 @@ __tt_pv_bg_recolor() {
|
|
|
588
603
|
|
|
589
604
|
__tt_pv_bg_panel() {
|
|
590
605
|
local name=$1 z=$'\e[0m' b=$'\e[1m' d=$'\e[2m' c=$ac val sty mark choice REPLY
|
|
591
|
-
local -a labs=(Size Position Opacity Colors) at=(
|
|
606
|
+
local -a labs=(Size Position Opacity Colors) at=(1 4 7 0) def=(${=bgdef[$1]})
|
|
592
607
|
local -i r0=$2 col=$3 end=$4 off=${bgoff[$1]} T=$(( $4 - $3 - 21 )) lo=100 hi=100 k i r knob pos=${bgpos[$1]} o tuned
|
|
593
608
|
(( color )) || z= b= d= c=
|
|
594
609
|
(( T < 8 )) && T=8
|
|
@@ -624,7 +639,7 @@ __tt_pv_bg_panel() {
|
|
|
624
639
|
fi
|
|
625
640
|
if (( k == 2 )); then
|
|
626
641
|
for (( i = 1; i <= 9; i++ )); do
|
|
627
|
-
out+=$'\e['$(( r0 + 2 + (i - 1) / 3 ))';'$(( col + 12 + (i - 1) % 3 * 3 ))'H'
|
|
642
|
+
out+=$'\e['$(( r0 + at[2] - 1 + (i - 1) / 3 ))';'$(( col + 12 + (i - 1) % 3 * 3 ))'H'
|
|
628
643
|
if (( ! color )); then
|
|
629
644
|
if (( i == pos )); then out+="#"; else out+="."; fi
|
|
630
645
|
elif (( i == pos && ! off )); then
|
|
@@ -669,14 +684,13 @@ __tt_pv_bg_panel() {
|
|
|
669
684
|
out+=$'\e['$r';'$end'H'$mark"↺"$z
|
|
670
685
|
fi
|
|
671
686
|
done
|
|
672
|
-
(( split )) && bgstrip="$(( r0 + 9 )) $col $end"
|
|
673
687
|
}
|
|
674
688
|
|
|
675
689
|
__tt_pv_bg_strip() {
|
|
676
690
|
local pal=$tune dir=${TTHEME_CONFIG:h}/backgrounds cur fill want sty top side bot cmd buf="" z=$'\e[0m' d=$'\e[2m' REPLY
|
|
677
691
|
local -a keys=(${=bgpics[$tune]}) wh pd
|
|
678
692
|
local -i r0=$1 col=$2 end=$3 n=${#keys} at show tc tr=3 i k x r id slot first
|
|
679
|
-
if (( n <
|
|
693
|
+
if (( n < 1 )); then
|
|
680
694
|
__tt_pv_bg_strip_off
|
|
681
695
|
return 0
|
|
682
696
|
fi
|
|
@@ -684,10 +698,8 @@ __tt_pv_bg_strip() {
|
|
|
684
698
|
[[ $tpick == *:* ]] || cur=${bgact[$pal]}
|
|
685
699
|
at=${keys[(Ie)$cur]}
|
|
686
700
|
(( at )) || at=1
|
|
687
|
-
buf+=$'\e['$r0';'$(( col + 2 ))'H'$d"Images"$z$'\e['$r0';'$(( end - ${#at} - ${#n} ))'H'$d"$at/$n"$z
|
|
688
701
|
pd=(${=bgpic[$pal:$keys[at]]})
|
|
689
702
|
if (( r0 + tr + 3 >= ph )) || ! __tt_bg_dim $dir/$pd[2]; then
|
|
690
|
-
print -rn -- "$buf"
|
|
691
703
|
__tt_pv_bg_strip_off
|
|
692
704
|
return 0
|
|
693
705
|
fi
|