diff --git a/Makefile b/Makefile index 3f0c954..d6df3ee 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ build-to-html: .PHONY: html/src/generated/Progress.md html/src/generated/Progress.md: - nu scripts/build-table > /dev/null + nu scripts/build-table html/book/Progress.html: html/src/generated/Progress.md pandoc \ diff --git a/html/ProgressHeader.html b/html/ProgressHeader.html index aed3338..8d6b85a 100644 --- a/html/ProgressHeader.html +++ b/html/ProgressHeader.html @@ -20,6 +20,7 @@ display: flex; flex-direction: column; min-height: 48px; + gap: 2px; align-items: center; justify-content: center; aspect-ratio: 1; diff --git a/scripts/build-table b/scripts/build-table index 686515b..fbe3e70 100755 --- a/scripts/build-table +++ b/scripts/build-table @@ -10,9 +10,9 @@ let chapters = { } let gradients = [ - [0, [90, 0, 0]], + [0, [60, 0, 0]], [0.65, [180, 180, 0]], - [1, [0, 90, 0]], + [1, [0, 120, 0]], ] let formatColor = {|color| $"rgb\(($color.0), ($color.1), ($color.2)\)" } @@ -31,17 +31,20 @@ let interpColor = {|p| do $formatColor $color } -let viz = { |k, n| - let ratio = ($k / $n) | math round --precision 1 - # let color = if n == 0 { "gray" } else if $ratio < 0.25 { "red" } else if $ratio < 0.5 { "orange"} else if $ratio < 0.75 { "yellow"} else { "green" } - let color = if $n == 0 { "gray" } else { do $interpColor ($k / $n) } +let viz = { |k, n, cell| + let ratio = $k / $n + let percent = $ratio * 100 | math round --precision 1 + let color = if $n == 0 { "gray" } else { do $interpColor $ratio } let textColor = if $k == $n { "gold" } else { "white" } + let isExercise = $cell.0.section == "Exercise" + let percentStr = $"($percent)%" $"