@lokiyou/pi-nano-footer 0.12.0 → 0.14.0
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/index.ts +6 -10
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -81,20 +81,16 @@ Editor.prototype.render = function (width: number): string[] {
|
|
|
81
81
|
const rgb = extractRGB(saved);
|
|
82
82
|
if (rgb) {
|
|
83
83
|
const [r, g, b] = rgb;
|
|
84
|
-
//
|
|
85
|
-
//
|
|
86
|
-
const t = 0.5 + 0.5 * Math.sin(performance.now() /
|
|
87
|
-
const bright = 0.
|
|
88
|
-
const glow = t * t * 0.
|
|
84
|
+
// 纯前景呼吸:当前色 + 峰值白色辉光,0.8s 周期
|
|
85
|
+
// 无背景阴影,避免生硬灯管感
|
|
86
|
+
const t = 0.5 + 0.5 * Math.sin(performance.now() / 191);
|
|
87
|
+
const bright = 0.35 + 0.65 * t; // 35%~100%
|
|
88
|
+
const glow = t * t * 0.45; // 0~0.45 白色 blend
|
|
89
89
|
const nr = Math.round(Math.min(255, r * bright + (255 - r) * glow));
|
|
90
90
|
const ng = Math.round(Math.min(255, g * bright + (255 - g) * glow));
|
|
91
91
|
const nb = Math.round(Math.min(255, b * bright + (255 - b) * glow));
|
|
92
|
-
// 阴影光晕背景:铺满格子模拟辉光
|
|
93
|
-
const sr = Math.round(nr * 0.2);
|
|
94
|
-
const sg = Math.round(ng * 0.2);
|
|
95
|
-
const sb = Math.round(nb * 0.2);
|
|
96
92
|
this.borderColor = (str: string) =>
|
|
97
|
-
|
|
93
|
+
`[38;2;${nr};${ng};${nb}m${str}[0m`;
|
|
98
94
|
}
|
|
99
95
|
try {
|
|
100
96
|
return origRender.call(this, width);
|