unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Emanuel Berg <incal@dataswamp.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Colouring a cell within a table
Date: Mon, 19 Sep 2022 18:13:43 +0200	[thread overview]
Message-ID: <87mtavbavc.fsf@dataswamp.org> (raw)
In-Reply-To: CAP_d_8Up3phLUJnTBYrBqCRKC7kSUzWmCU0EyBQANzUU4EBYKw@mail.gmail.com

Yuri Khan wrote:

>> Am looking for information to see how I can colour a cell
>> within a table. Ideally I would like to have a keybinding
>> so that when I an in a cell its background in changed to
>> a different colour.
>
> Why do you want to do this?
>
> In general, coloring parts of a document in predefined
> colors is a bad thing to want. Users with a different color
> theme than yours will have trouble reading the document.
>
> A better direction is to define a major mode for your class
> of documents, a few faces, and fontification rules that find
> fragments your users would want colored and apply those
> faces. The user will be able to customize the faces to
> their liking.

The Emacs mode already has support for font lock
(AKA "syntax highlighting" outside the Emacs world) for the
desired document type. If a different or more tivoli than that
is desired, configure it or add new font lock rules with
`font-lock-add-keywords', e.g.

(font-lock-add-keywords 'emacs-lisp-mode
 '(
   ("`.*'"                                .  font-lock-reference-face)
   ("font-lock-builtin-face"              .  font-lock-builtin-face)
   ("font-lock-comment-delimiter-face"    .  font-lock-comment-delimiter-face)
   ("font-lock-comment-face"              .  font-lock-comment-face)
   ("font-lock-constant-face"             .  font-lock-constant-face)
   ("font-lock-doc-face"                  .  font-lock-doc-face)
   ("font-lock-function-name-face"        .  font-lock-function-name-face)
   ("font-lock-keyword-face"              .  font-lock-keyword-face)
   ("font-lock-negation-char-face"        .  font-lock-negation-char-face)
   ("font-lock-preprocessor-face"         .  font-lock-preprocessor-face)
   ("font-lock-reference-face"            .  font-lock-reference-face)
   ("font-lock-regexp-grouping-backslash" . 'font-lock-regexp-grouping-backslash)
   ("font-lock-regexp-grouping-construct" . 'font-lock-regexp-grouping-construct)
   ("font-lock-string-face"               .  font-lock-string-face)
   ("font-lock-type-face"                 .  font-lock-type-face)
   ("font-lock-variable-name-face"        .  font-lock-variable-name-face)
   ("font-lock-warning-face"              .  font-lock-warning-face)
   )
 t)

Those faces are then, much like the Donald Trump supporters
that stormed the Capitolium ...

  https://dataswamp.org/~incal/figures/emacs/dressed-up-as-themselves.png

-- 
underground experts united
https://dataswamp.org/~incal




  reply	other threads:[~2022-09-19 16:13 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-17 12:35 Colouring a cell within a table uzibalqa
2022-09-18  7:54 ` Jean Louis
2022-09-18 14:33   ` uzibalqa
2022-09-18 21:22     ` uzibalqa
2022-09-19  7:46       ` Jean Louis
2022-09-19  9:39         ` Emanuel Berg
2022-09-19  7:42     ` Jean Louis
2022-09-19 13:15       ` uzibalqa
2022-09-19 16:51       ` Christopher Dimech
2022-09-19 15:29 ` Yuri Khan
2022-09-19 16:13   ` Emanuel Berg [this message]
2022-09-22 13:40     ` uzibalqa
2022-09-19 16:33   ` Christopher Dimech

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=87mtavbavc.fsf@dataswamp.org \
    --to=incal@dataswamp.org \
    --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).