Closed DivvyCr closed 2 years ago
I want the posframe border colour to reflect the severity of the error(s).
With my limited experience, I was thinking of adding the following function:
(defun flycheck-posframe-highest-error-level-face (errs) "Return the face corresponding to the highest error level from ERRS." (flycheck-posframe-get-face-for-error (cl-reduce (lambda (err1 err2) (if (flycheck-error-level-< err1 err2) err2 err1)) errs)))
To apply for the border colour, based on the option flycheck-posframe-border-use-error-face:
flycheck-posframe-border-use-error-face
(defun flycheck-posframe-show-posframe (errors) "Display ERRORS, using posframe.el library." (posframe-hide flycheck-posframe-buffer) (when (and errors (not (run-hook-with-args-until-success 'flycheck-posframe-inhibit-functions))) (let ((poshandler (intern (format "posframe-poshandler-%s" flycheck-posframe-position)))) (unless (functionp poshandler) (setq poshandler nil)) (flycheck-posframe-check-position) (posframe-show flycheck-posframe-buffer :string (flycheck-posframe-format-errors errors) :background-color (face-background 'flycheck-posframe-background-face nil t) :position (point) :internal-border-width flycheck-posframe-border-width - :internal-border-color (face-foreground 'flycheck-posframe-border-face nil t) + :internal-border-color (face-foreground (if flycheck-posframe-border-use-error-face + (flycheck-posframe-highest-error-level-face errors) + 'flycheck-posframe-border-face) nil t) :poshandler poshandler :hidehandler #'flycheck-posframe-hidehandler))))
Examples from my local implementation:
Sure, please feel free to send a PR since it looks like you probably have most of the code to do this.
Pull #32 has been merged, closing this issue. Thanks again for this.
I want the posframe border colour to reflect the severity of the error(s).
With my limited experience, I was thinking of adding the following function:
To apply for the border colour, based on the option
flycheck-posframe-border-use-error-face
:Examples from my local implementation: