emacs-devel
[Top][All Lists]
Advanced

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

Re: Automatic face setting based on contrast?


From: Stefan Kangas
Subject: Re: Automatic face setting based on contrast?
Date: Tue, 5 Oct 2021 19:10:48 -0400

Richard Stallman <rms@gnu.org> writes:

>   > I made this point in the above bug report, but there is no way to
>   > style Emacs with 25-50 face definitions.  It is very hard to put an
>   > exact number on this, as e.g. some faces are inherited and therefore
>   > more important, but realistically speaking you need at least twice
>   > that to have a somewhat decent coverage.
>
> Is this something that could be fixed, in principle?  Could a theme
> specify some faces manually, and then Emacs would adjust various other
> faces automatically so as to contrast with some of those?
>
> Currently, a face can inherit properties from another face.
> Could there be a kind of contrast-inheritance where face A
> is set automatically to contrast strongly with B, and contrast
> somewhat with C and D?  Based on calculations on the RGB codes,
> I imagine.
>
> This would call for a bit of research, but if we got it to work,
> specifying a good theme might become a lot easier.

I think it would be hard to find something "perfect", but if the goal is
to get something "good enough" or even just "a bit better", then it
sounds more achievable.

solarized themes has an interesting concept, where you only need to
specify a few base colors that the rest of the theme is calculated from.

So here's a theme definition:

;; inspired vim's jellybeans color-theme
(solarized-create-theme-file-with-palette 'light 'solarized-jellybeans-light
  '("#202020" "#ffffff"
    "#ffb964" "#8fbfdc" "#a04040" "#b05080" "#805090" "#fad08a"
"#99ad6a" "#8fbfdc"))

You can also override individual faces in case the algorithm fails.

I have no idea how well suited this approach is for general use, but I
suspect that you end up with a theme that fits within very specific
parameters.

Another idea is semantic faces.  For example, instead of just having the
face `info-title-1', we would have a general face `title1' that a face
in a mode that implements headlines would inherit from.  We obviously
already have some semantic faces, like `font-lock-doc-face', but the
concept could perhaps be developed.



reply via email to

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