branch: externals/rcirc-color commit a6edf362faefc7518e1420c42d86a2c5a2a691a3 Author: Philip Kaludercic <phil...@posteo.net> Commit: Philip Kaludercic <phil...@posteo.net>
Add group information to rcirc-color * rcirc-color.el (rcirc-color): Add a group. (rcirc-colors): Make a user option. (rcirc-color-is-deterministic): Make a user option. (rcirc-color-other-attributes): Make a user option. --- rcirc-color.el | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/rcirc-color.el b/rcirc-color.el index 49a56dcf20..356fa89e21 100644 --- a/rcirc-color.el +++ b/rcirc-color.el @@ -34,6 +34,10 @@ (require 'rcirc) +(defgroup rcirc-color () + "Highlight nicknames in rcirc." + :group 'rcirc) + (defun rcirc-color-distance (color1 color2) "Compute the difference between two colors. The difference between COLOR1 and COLOR2 is computed using the @@ -58,7 +62,7 @@ everything by 256. This also helps preventing integer overflow." (* 4 dg dg) (ash (* (- 767 red-mean) db db) -8))))) -(defvar rcirc-colors +(defcustom rcirc-colors (let ((min-distance 200); heuristics (bg (face-background 'default)) (fg (face-foreground 'rcirc-my-nick)) @@ -80,21 +84,25 @@ By default, all the non-grey colors that are very different from the default background are candidates. This uses `rcirc-color-distance' to compute distance between colors. -To check out the list, evaluate (list-colors-display rcirc-colors).") +To check out the list, evaluate (list-colors-display rcirc-colors)." + :type '(repeat color)) (defvar rcirc-color-mapping (make-hash-table :test 'equal) "Hash-map mapping nicks to color names.") -(defvar rcirc-color-is-deterministic nil +(defcustom rcirc-color-is-deterministic nil "Normally rcirc just assigns random colors to nicks. These colors are based on the list in `rcirc-colors'. If you set this variable to a non-nil value, an md5 hash is computed based on the nickname and the first twelve bytes are -used to determine the color: #rrrrggggbbbb.") +used to determine the color: #rrrrggggbbbb." + :type 'boolean) -(defvar rcirc-color-other-attributes nil +(defcustom rcirc-color-other-attributes nil "Other attributes to use for nicks. -Example: (setq rcirc-color-other-attributes '(:weight bold))") +Example: (setq rcirc-color-other-attributes '(:weight bold))" + :type 'plist) + (defun rcirc-color--facify (orig-fun string face &rest args) "Add colors to other nicks based on `rcirc-colors'."