From: Emanuel Berg <embe8573@student.uu.se>
To: help-gnu-emacs@gnu.org
Subject: Re: Custom colour for a custom command
Date: Fri, 02 Oct 2015 02:00:58 +0200 [thread overview]
Message-ID: <87r3le16md.fsf@debian.uxu> (raw)
In-Reply-To: 87mvw3re4i.fsf@skimble.plus.com
Sharon Kimble <boudiccas@skimble.plus.com> writes:
> I have a latex command called "\myparencite{foo}"
> which has the same colour as the surrounding text.
(font-lock-add-keywords 'latex-mode
'(("\\(myparencite\\){\\(.*\\)}" (1 font-lock-constant-face)
(2 font-lock-doc-face) )))
Note: If you open a file.tex, you might end up in
TeX-mode or some other mode to do (La)TeX. So, first
see if it works (after evaluation) with
M-x latex-mode RET
then, if your mode isn't that, make the substitution
in the code.
> How can I have a colour of :foreground "green"
> :background "black" for it in my theme please?
As you see in the code, use the font-lock-*
faces instead. I'm sure one of yours is green, so
use that.
One way of finding out which one is green is putting
point at a char that has a green face and then invoke
this:
(defun what-face (pos)
(interactive "d")
(let((face (or (get-char-property pos 'face)
(get-char-property pos 'read-cf-name) )))
(message " Face: %s" (or face "(no face!)")) ))
Source: http://user.it.uu.se/~embe8573/conf/emacs-init/faces.el
--
underground experts united
http://user.it.uu.se/~embe8573
next prev parent reply other threads:[~2015-10-02 0:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-30 17:49 Custom colour for a custom command Sharon Kimble
2015-10-02 0:00 ` Emanuel Berg [this message]
2015-10-02 19:13 ` Sharon Kimble
2015-10-03 0:47 ` Emanuel Berg
2015-10-03 1:16 ` Emanuel Berg
2015-10-04 0:22 ` Emanuel Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r3le16md.fsf@debian.uxu \
--to=embe8573@student.uu.se \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).