fix(v1.11.1): 深渊周期色块逐周期减淡,方便一眼区分周期
build / build-and-test (push) Successful in 3m17s

- 深渊模式的整段色块增加按周期递减的底色浓度:第一个周期 22%,之后线性
  减淡,最后一个周期 10%(X 个周期时按 X 等分);同一周期内所有格子保持
  同一浓度,跨周期边界会出现一档明显的深浅变化。
- 通行证仍保持固定 18% 的自定义色淡化,不受影响。
- DayCell 新增 BlockPercent,日历格子通过 --block-pct 传给 color-mix;
  旧缓存页面没有该变量时回落到 18%。
- 版本号 1.11.0 → 1.11.1。

验证:4 周期深渊在日历上的浓度为 22/18/14/10%;截图实测第 1 周期底色
rgb(212,223,235)、第 2 周期 rgb(220,229,239),同周期内一致;gofmt / go vet /
go test 全绿。
This commit is contained in:
2026-10-20 02:42:52 +08:00
parent bc5076ee41
commit 8d9cf658a3
5 changed files with 31 additions and 5 deletions
+26
View File
@@ -32,6 +32,8 @@ type DayCell struct {
BlockTotal int
BlockText string
BlockTitle string
// BlockPercent 色块底色浓度:通行证固定 18%,深渊按周期依次减淡
BlockPercent int
// PendingCount 当日还没完成的单数(= TaskCount - DoneCount)
PendingCount int
Tickets []Ticket
@@ -448,6 +450,11 @@ func (s *Server) handleCalendar(w http.ResponseWriter, r *http.Request) {
cell.BlockTotal = cs.blockTotal()
cell.BlockText = fmt.Sprintf("%d/%d", cell.BlockDone, cell.BlockTotal)
cell.BlockTitle = cs.sub.PackageName + " · " + cell.BlockText
cell.BlockPercent = 18
if cs.sub.Abyss && cs.sub.CycleDays > 0 {
idx := domain.CycleIndex(cs.start, day, cs.sub.CycleDays)
cell.BlockPercent = abyssBlockPercent(idx, cs.sub.TotalCount)
}
}
continue
}
@@ -657,6 +664,25 @@ func assigneeStrip(tickets []Ticket) []string {
return out
}
// abyssBlockPercent 深渊色块浓度:第一个周期 22%,之后每个周期依次减淡,
// 最后一个周期 10%(周期数大于 1 时线性过渡)。
func abyssBlockPercent(idx, total int) int {
if total <= 1 {
return 22
}
if idx < 0 {
idx = 0
}
if idx >= total {
idx = total - 1
}
pct := 22 - (idx*12)/(total-1)
if pct < 10 {
pct = 10
}
return pct
}
func heatLevel(n int) int {
switch {
case n <= 0: