aboutsummaryrefslogtreecommitdiff
path: root/dump.scm
diff options
context:
space:
mode:
authorArun Isaac2021-12-13 14:48:13 +0530
committerArun Isaac2021-12-13 14:48:13 +0530
commit50022ec01baadc6f2d1b51e932259fc8dea87650 (patch)
treebc8e40605ebd66da80fe784047dc3a1c63c54596 /dump.scm
parenta166f61180880971b5b916604a74ee98955bf385 (diff)
downloadgn-transform-databases-50022ec01baadc6f2d1b51e932259fc8dea87650.tar.gz
Color table headers by size.
* dump.scm (human-units-color): New function. (dump-schema): Use human-units-color.
Diffstat (limited to 'dump.scm')
-rwxr-xr-xdump.scm10
1 files changed, 9 insertions, 1 deletions
diff --git a/dump.scm b/dump.scm
index 57c9001..f8b3513 100755
--- a/dump.scm
+++ b/dump.scm
@@ -561,6 +561,13 @@ case-insensitive."
((2) "MiB")
(else "GiB")))))
+(define (human-units-color bytes)
+ "Return the table header color coding for a table of size BYTES."
+ (let* ((color-scheme "purd4"))
+ (format #f "/~a/~a"
+ color-scheme
+ (1+ (min (floor-log1024 bytes) 3)))))
+
;; This wrapper function is necessary to work around bugs in (ccwl
;; graphviz) whereby backslashes in node labels are escaped as \\, and
;; HTML strings are escaped incorrectly.
@@ -636,7 +643,8 @@ serialized string."
"white"))
(label . ,(sxml->graphviz-html
`(table (@ (border 0))
- (tr (td (@ (border 1))
+ (tr (td (@ (border 1)
+ (bgcolor ,(human-units-color (table-size table))))
,(format #f "~a (~a)"
(table-name table)
(human-units (table-size table)))))