diff options
author | Hugo Hörnquist <hugo@hornquist.se> | 2020-01-30 22:51:45 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@hornquist.se> | 2020-01-30 22:51:45 +0100 |
commit | f852c30bcef530d18a474ab6ab8350a3ef93d563 (patch) | |
tree | 00fc29a6ff1a8c842d0a526f04d4124977dd6e46 /module/output/general.scm | |
parent | Update recurrence generate to new date obj. (diff) | |
download | calp-f852c30bcef530d18a474ab6ab8350a3ef93d563.tar.gz calp-f852c30bcef530d18a474ab6ab8350a3ef93d563.tar.xz |
Once again compiles.
Diffstat (limited to '')
-rw-r--r-- | module/output/general.scm | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/module/output/general.scm b/module/output/general.scm index 526c449e..4d9b4ce8 100644 --- a/module/output/general.scm +++ b/module/output/general.scm @@ -3,12 +3,18 @@ ;; Returns a color with good contrast to the given background color. (define-public (calculate-fg-color c) - (define (str->num c n) (string->number (substring/shared c n (+ n 2)) 16)) - (let ((r (str->num c 1)) - (g (str->num c 3)) - (b (str->num c 5))) - (if (< 1/2 (/ (+ (* 0.299 r) - (* 0.587 g) - (* 0.144 b)) - #xFF)) - "#000000" "#e5e8e6"))) + (catch #t + (lambda () + (define (str->num c n) (string->number (substring/shared c n (+ n 2)) 16)) + (let ((r (str->num c 1)) + (g (str->num c 3)) + (b (str->num c 5))) + (if (< 1/2 (/ (+ (* 0.299 r) + (* 0.587 g) + (* 0.144 b)) + #xFF)) + "#000000" "#e5e8e6"))) + (lambda args + (format (current-error-port) "Error calculating foreground color?~%~a~%" args) + "#FF0000" + ))) |