4 ms·
The source code is on https://github.com/Zaku-eu/colourco.de https://github.com/Zaku-eu/colourco.de . Maybe you can check it out
by mih 13y ago
The source code is on https://github.com/Zaku-eu/colourco.de https://github.com/Zaku-eu/colourco.de . Maybe you can check it out
- scottjad 13y agoThank you. https://github.com/Zaku-eu/colourco.de/blob/be7a41500fd1b3580c748cf139e9d8b52f67705b/client/converter.coffee#L73 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))