help-gnu-emacs
[Top][All Lists]
Advanced

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

still color


From: Emanuel Berg
Subject: still color
Date: Wed, 24 Aug 2022 01:01:27 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

;;; -*- lexical-binding: t -*-

(defalias '** #'expt)

(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      (ceiling (/ (+ r g) 2.0)))
        (diff    (- b rg)) )
    (<= min-adv diff) ))

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

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]