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:
+2 -2
View File
@@ -798,10 +798,10 @@ fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
/* 通行证 / 深渊:整段连续着色,每格显示同一个「已完成/总数」 */
.cal-cell.has-block {
background: color-mix(in srgb, var(--block) 18%, var(--app-surface));
background: color-mix(in srgb, var(--block) var(--block-pct, 18%), var(--app-surface));
border-color: color-mix(in srgb, var(--block) 24%, var(--app-border));
}
.cal-cell.has-block:hover { background: color-mix(in srgb, var(--block) 26%, var(--app-surface)); }
.cal-cell.has-block:hover { background: color-mix(in srgb, var(--block) calc(var(--block-pct, 18%) + 6%), var(--app-surface)); }
.cal-cell.has-block.today .dnum { background: var(--block); color: #fff; }
.cell-block {
display: inline-flex; align-items: center; gap: 4px;
+1 -1
View File
@@ -41,7 +41,7 @@
<div class="cal-week" role="row">
{{range .}}
<a class="cal-cell heat-{{.Heat}}{{if not .InMonth}} out{{end}}{{if .IsToday}} today{{end}}{{if .IsSelected}} sel{{end}}{{if .IsWeekend}} weekend{{end}}{{if .DueCount}} has-due{{end}}{{if .BlockColor}} has-block{{end}}"
href="/calendar?y={{$.D.Year}}&m={{$.D.Month}}&d={{.Date}}&{{$.D.FilterQuery}}" role="gridcell"{{if .BlockColor}} style="--block:{{.BlockColor}}"{{end}}>
href="/calendar?y={{$.D.Year}}&m={{$.D.Month}}&d={{.Date}}&{{$.D.FilterQuery}}" role="gridcell"{{if .BlockColor}} style="--block:{{.BlockColor}};--block-pct:{{.BlockPercent}}%"{{end}}>
{{if .Strip}}<span class="asg-strip" aria-hidden="true">{{range .Strip}}<i style="background:{{.}}"></i>{{end}}</span>{{end}}
<div class="cell-top">
<span class="dnum">{{.Day}}</span>