emacs-devel
[Top][All Lists]
Advanced

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

Re: [External] : Re: Could the current font-lock mechanism support font


From: Arthur Miller
Subject: Re: [External] : Re: Could the current font-lock mechanism support font locking code in comments?
Date: Wed, 31 Mar 2021 02:10:07 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (windows-nt)

Drew Adams <drew.adams@oracle.com> writes:

>> > the comment starter // should have regular comment color and the code
>> > inside should be syntax highlighted with dimmed colors of the regular
>> > faces.
>> > Does this complicate things?
>> 
>> Yes and no: AFAIK Emacs's faces don't support "dimming", so you either
>> do it the hard way and get what you describe (which requires creating new
>> faces and hence knowing which faces are used by the current
>> font-lock-rules, etc...), or you take the easy way out and just apply an
>> additional face that marks the commented out code in some other way
>> (e.g. by adding a background color).
>
> Vanilla Emacs might not have dimming, but Emacs has it.
>
> Library `doremi-frm.el' provides commands that let
> you incrementally dim or strengthen a face or frame
> foreground or background.
>
> WYSIWYG - you can see the change in a sample, with
> an original sample next to it, for comparison.  Hit
> `C-g' to cancel the changes, or `RET' to accept them.
>
> For example, command `doremi-face-bg+' changes the
> foreground color of a face.  You can change any of
> these color components at any time, switching to
> another just by typing its initial letter:
>
>   `r' - red
>   `g' - green
>   `b' - blue
>   `h' - hue (basic color)
>   `s' - saturation (purity)
>   `v' - value (brightness)
>
>   `R' - red, green, and blue, at the same time
>   `H' - hue, saturation, and value, at the same time
>
> For example, you can type `v' and use the arrow keys or
> mouse wheel to change the value component, then type `s'
> and use the arrows or wheel to change the saturation
> component, and so on, all in the same call to the command.
>
> Depending on what kind of "dimming" effect you want, it
> means changing the value (brightness) component or the
> saturation component, or both.
>
> `doremi-face-fg+ does the same thing, but acts on the
> face foreground, not background.  And `doremi-bg+' and
> `doremi-fg+' act on the frame foreground and background,
> instead of those of a particular face.
>
> `doremi-frm.el' requires these other libraries.  All are
> available on Emacs Wiki.
>
>   `doremi.el'
>   `hexrgb.el'
>   `frame-fns.el'
>   `faces+.el'
>
> Doc: https://www.emacswiki.org/emacs/DoReMi
>
> Code: https://www.emacswiki.org/emacs/download/doremi-frm.el

One way is, maybe, to use theme that support different shades of color
such as B. Batsov's implementation of Solarized. Solarized ahs 8 base
colors and 8 accent colors. Batsov has introduced 8 brither and 8 darker
shades ot those 8 accent colors. A theme creator could use that scheme
to create a syntax highlight scheme where normal syntax colors uses
those 8 accented color and brighter/darker accents in comments.

I am not sure about the approach, just an idea.



reply via email to

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