[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Starting emacs with coloured annotations
From: |
fatiparty |
Subject: |
Starting emacs with coloured annotations |
Date: |
Tue, 15 Mar 2022 22:20:27 +0100 (CET) |
I want to colour comments using normal weight, bet have everything else in
bold.
Have not been able to have the following code get comments with normal weight
and display the scratch buffer comments using the low contrast colour #8600E6
when using a dark theme.
(defun bold-frames ()
"Set bold weight attribute for all frames."
(set-face-attribute 'default nil :weight 'bold))
(defun annotation-style ()
"Set colour for the comment delimiter.
Use normal weight typeface for comments."
(set-face-attribute 'font-lock-comment-face nil
:weight 'normal :slant 'italic))
(defun annotation-delimiter-colour ()
"Set foreground colour for the comment delimiter."
(if (eq 'dark (frame-parameter nil 'background-mode))
(set-face-attribute 'font-lock-comment-delimiter-face nil
:foreground "#00FF00")
(set-face-attribute 'font-lock-comment-delimiter-face nil
:foreground "#00FFFF") ))
(defvar annotation-chroma
'( (dark . ((low . "#8600E6") (mid . "#AA33FF") (high . "#C370FF")))
(light . ((low . "#C16BFF") (mid . "#AA33FF") (high . "#8000DB"))) )
"Colour contrast for comments, indigo on dark and light background.")
(defun annotation-body-colour (chroma)
"Set the foreground colour for comments following delimiter.
CHROMA Intensity Key used for setting colour of comments ."
(let* ( (colors annotation-chroma)
(frame-bg (frame-parameter nil 'background-mode))
(levels (alist-get frame-bg colors)) )
(face-remap-add-relative 'font-lock-comment-face
`(:foreground ,(alist-get chroma levels)))) )
(defun annotation-low-contrast ()
(annotation-body-colour 'low))
(defun annotation-tools ()
"Aggregate annotation tools for comments."
(bold-frames)
(annotation-style)
(annotation-delimiter-colour)
(annotation-low-contrast)
(annotation-keytrigger))
;;;###autoload
(define-minor-mode annotation-minor-mode "Focused editing."
:lighter " annotation" ; indicator in mode-line
(let ( (w (face-attribute 'default :weight)) )
(set-face-attribute 'font-lock-comment-face nil :weight w))
(when annotation-minor-mode (annotation-tools)) )
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Starting emacs with coloured annotations,
fatiparty <=