Hacker News new | past | comments | ask | show | jobs | submit login

Thank you.

https://github.com/Zaku-eu/colourco.de/blob/be7a41500fd1b358...

or a convenient Emacs command/function:

  (defun rgb-to-fgc (&optional background)
    "Returns a hex RGB triplet string for a chosen color or
  BACKGROUND."
    (interactive)
    (let ((background-rgb (color-name-to-rgb (or background
                                                 (read-color nil t))))
          (m (/ 96.0 255))
          (foreground-rgb (mapcar (lambda (x)
                                    (+ x (if (> (apply #'max background-rgb)
                                                (- 1 m))
                                             (* m -1)
                                           m)))
                                  background-rgb))
          (foreground (apply #'color-rgb-to-hex foreground-rgb)))
      (message foreground)
      foreground))



Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: