Le samedi 13 mai 2023 à 14:13 +0200, Luca Rossetto Casel a écrit :

> Hello everyone,
> 
> I'm working on an example for a musicological paper. I was requested to 
> highlight some notes drawing a colored circle around them. I found the 
> snippet
> 
> [https://lsr.di.unimi.it/LSR/Item?id=722](https://lsr.di.unimi.it/LSR/Item?id=722)
> 
> and I tried to adapt it to my needs... but without success (I didn't 
> ever studied Scheme, but I'd like to learn how to use it: all I was able 
> to do is to change the color of the circle *and* the notehead).
> 
> 
> How can I change the color of the circle, leaving the notehead black?
> 
> Thanks in advance!!!



Re "I'd like to learn how to use Scheme": are you aware of 
https://extending-lilypond.gitlab.io ?

With that being said, this can be refactored to use markup, making it perhaps 
more familiar for someone without Scheme background:

```
\version "2.24.1"

circleB =
\once \override NoteHead.stencil =
#(grob-transformer
  'stencil
  (lambda (grob original)
    (grob-interpret-markup
     grob
     #{
        \markup \with-outline \stencil #original
        \overlay {
          \stencil #original
          \align-on-other #X
            #CENTER \stencil #original
            #CENTER \draw-circle #1.5 #0.1 ##f 
          }
     #})))

{
  \circleB c'' \circleB c'' \circleB c''2
  \circleB c''1 \circleB c''8 \circleB a'8
  \circleB b'16 \circleB c''16 \circleB b'16 \circleB a'16
  \circleB f'2
}
```

You can then add `\with-color "red"` before `\draw-circle` or do other 
transformations.

Jean

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to