diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-08-17 18:39:53 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-08-17 18:40:00 +0200 |
commit | f12fca91b185cbf83fbe173fadf6a46f6c3c0c65 (patch) | |
tree | de863658e3494ca3927095a28e44d0e1f4ce5d6d /module/output/color.scm | |
parent | move terminal output. (diff) | |
download | calp-f12fca91b185cbf83fbe173fadf6a46f6c3c0c65.tar.gz calp-f12fca91b185cbf83fbe173fadf6a46f6c3c0c65.tar.xz |
Fixes.
Diffstat (limited to 'module/output/color.scm')
-rw-r--r-- | module/output/color.scm | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/module/output/color.scm b/module/output/color.scm deleted file mode 100644 index 123d0ba2..00000000 --- a/module/output/color.scm +++ /dev/null @@ -1,22 +0,0 @@ -(define-module (output color) - ) - -;; Returns a color with good contrast to the given background color. -;; https://stackoverflow.com/questions/1855884/determine-font-color-based-on-background-color/1855903#1855903 -(define-public (calculate-fg-color c) - (catch #t - (lambda () - (define (str->num c n) (string->number (substring/shared c n (+ n 2)) 16)) - ;; (format (current-error-port) "COLOR = ~s~%" c) - (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.114 b)) - #xFF)) - "#000000" "#FFFFFF"))) - (lambda args - (format (current-error-port) "Error calculating foreground color?~%~s~%" args) - "#FF0000" - ))) |