help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Colouring a cell within a table


From: Emanuel Berg
Subject: Re: Colouring a cell within a table
Date: Mon, 19 Sep 2022 18:13:43 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]