[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: still blue



Thomas Schmitt wrote:

> So i added the constraint that (Red - Green) must not be
> smaller than -64 and not larger than +32. This made the
> blueish impression quite stable.

OK! I added that ...

;;; -*- lexical-binding: t -*-
;;
;; this file:
;;   https://dataswamp.org/~incal/emacs-init/color-incal.el

(require 'math)

(defun color-p (c)
  (and (integerp c)
       (<= 0  c)
       (< c (** 2 8)) ))

(defun blue-p (r g b)
  (unless (and (color-p r)
               (color-p g)
               (color-p b) )
    (error "Bogus data") )
  (let*((min-adv (** 2 6))
        (rg      (ceil (/ (+ r g) 2.0)))
        (diff    (- b rg))
        (rg-diff (- r g)) )
    (and (<= min-adv diff)
         (< -64 rg-diff)
         (< rg-diff 32) )))

;; (blue-p   0   0  64) ; t
;; (blue-p   1   0  64) ; nil
;; (blue-p 191 191 255) ; t
;; (blue-p 191 192 255) ; nil

> I think the ultimate test for correctness it the personal
> impression of the colors.

Indeed, why not?

> Either by your keyborad lights or by above xterm
> color setting.

:O

Did I say that or did you read my mind?

Indeed, I would like to have "all blue" and all-green random
commands for the keyboard on a key-by-key basis :)

https://dataswamp.org/~incal/#hw

-- 
underground experts united
https://dataswamp.org/~incal


Reply to: