Re: Background Colour

2021-05-18 Thread darkijah

\version "2.22.1"

\relative d' {a b c d a b c d a b c d a b c d a b c d }
\relative d' {\override Staff.Clef.color = #(rgb-color 0.953 0.471 
0.125) a b c d a b c d e a b c d a b c d a b c

}

Fixed somewhat your color to the clef, I made a little darker so it is 
still visible, but I used your color and made it darker, if that is the 
color you like :)


Dearly regards
- Darkijah



Re: Background Colour

2021-05-18 Thread Jean Abou Samra



Le 18/05/2021 à 17:55, Lukas-Fabian Moser a écrit :

Hi Jean,


How about a separate grob with engraver? Try the attached.


This should be included in the documentation as a textbook example for 
a not-quite-trivial, but reasonably straightforward example of a both 
a custom engraver and a custom grob.


Well, the documentation doesn't have any material about Scheme engravers 
yet. For now, I'll add it to the guide I wrote up.



Thanks very much for this!


You're welcome.

And wouldn't it be worth to add the convenience macro define-grob! to 
LilyPond's stock scheme library?


In this state, it is a dirty hack that will cause problems in particular 
cases (like defeating per-session semantics). I'd rather recode this 
part of the internals so that grobs can be defined with a nicer 
interface. For some time, I have been musing with the perspective of 
grob definitions in a fashion similar to context definitions, borrowing 
most of the syntax, like:


\layout {
  \grob {
    \NoteHead
    color = "red"
  }
  \grob {
    \name Highlight
    \type Item
    \interface text-interface
    \interface ...
    stencil = #highlight::print
    Y-extent = ##f
    ...
  }
}

I'd be happy if someone led discussions for this and implemented it in 
some form; I might do it at some point, but my contributor stack already 
contains quite a few projects currently.


Best,
Jean




Re: Background Colour

2021-05-18 Thread Lukas-Fabian Moser

Hi Jean,


How about a separate grob with engraver? Try the attached.


This should be included in the documentation as a textbook example for a 
not-quite-trivial, but reasonably straightforward example of a both a 
custom engraver and a custom grob. Thanks very much for this!


And wouldn't it be worth to add the convenience macro define-grob! to 
LilyPond's stock scheme library?


Lukas




Re: Background Colour

2021-05-18 Thread Jean Abou Samra


Le 18/05/2021 à 16:38, Lukas-Fabian Moser a écrit :


Seeing the discussion on coloured lyrics, colour this and that, I 
realized that for some parts I do change the Background Colour of 
the clefs maually (using a standard ofice yellow marking (grease) 
pencil each time after an update print. The purpose is to have a 
fast recognition point for the eyes to jump to the next line and/or 
page.


How about:


Improved version that only tweaks the stencil after-line-breaking:

\version "2.19"

#(define (positive-number? x) (and (number? x) (positive? x)))

markerPen =
#(define-music-function
  (X-padding Y-padding grob-path)
  ((positive-number? 0.5) (positive-number? 0) key-list?)
  #{
    \override #grob-path .layer = -1
    \override #grob-path .after-line-breaking =
    #(lambda (grob)
   (let*
    ((original (ly:grob-property grob 'stencil))
 (X-ext (ly:stencil-extent original X))
 (Y-ext (ly:stencil-extent original Y)))
    (ly:grob-set-property!
 grob 'stencil
 (ly:stencil-add
  (ly:make-stencil
   (ly:stencil-expr (stencil-with-color
 (ly:round-filled-box
  (interval-widen X-ext X-padding)
  (interval-widen Y-ext Y-padding)
  1)
 yellow))
   empty-interval empty-interval)
  original
  #})

\new Staff \with {
  \markerPen Clef
}
\relative {
  c'4 d \once\markerPen 0.5 0.5 Accidental es fis
  \once \markerPen Staff.BarLine
  g \markerPen 0.5 0.5 NoteHead g a
}

While this does not solve the problem of the marking affecting 
inter-system spacing, at least it now works fine for accidentals.



How about a separate grob with engraver? Try the attached.

Is there also a possibility to automatically colour the background in 
Lilypond, or is there a feature wishlist to which I could add this


You could add it at https://gitlab.com/lilypond/lilypond/-/issues

A variant marking a complete voice in another background colour or 
only the clef(s) would probably also do.


I have been working on something pretty much like that lately.

Is there a way to make a color glow from an image? I actually need 
something of that sort for the colored notes.


With the attached code,

\override TheGrob.highlight-me = ##t

\override TheGrob.highlight-details.stencil = #ly:text-interface::print

\override TheGrob.highlight-details.text = \markup \epsfile #X #2.0 
"path/to/an/EPS/image.eps"


(Adjust the 2.0 to the desired width.)

Best,
Jean

\version "2.23.3"

#(define (define-grob! grob-name grob-entry)
   (let* ((meta-entry   (assoc-get 'meta grob-entry))
  (class(assoc-get 'class meta-entry))
  (ifaces-entry (assoc-get 'interfaces meta-entry)))
 (set-object-property! grob-name 'translation-type? ly:grob-properties?)
 (set-object-property! grob-name 'is-grob? #t)
 (set! ifaces-entry (append (case class
  ((Item) '(item-interface))
  ((Spanner) '(spanner-interface))
  ((Paper_column) '((item-interface
 paper-column-interface)))
  ((System) '((system-interface
   spanner-interface)))
  (else '(unknown-interface)))
ifaces-entry))
 (set! ifaces-entry (uniq-list (sort ifaces-entry symbol

marker.pdf
Description: Adobe PDF document


Re: Background Colour

2021-05-18 Thread Lukas-Fabian Moser



Seeing the discussion on coloured lyrics, colour this and that, I 
realized that for some parts I do change the Background Colour of the 
clefs maually (using a standard ofice yellow marking (grease) pencil 
each time after an update print. The purpose is to have a fast 
recognition point for the eyes to jump to the next line and/or page.


How about:


Improved version that only tweaks the stencil after-line-breaking:

\version "2.19"

#(define (positive-number? x) (and (number? x) (positive? x)))

markerPen =
#(define-music-function
  (X-padding Y-padding grob-path)
  ((positive-number? 0.5) (positive-number? 0) key-list?)
  #{
    \override #grob-path .layer = -1
    \override #grob-path .after-line-breaking =
    #(lambda (grob)
   (let*
    ((original (ly:grob-property grob 'stencil))
 (X-ext (ly:stencil-extent original X))
 (Y-ext (ly:stencil-extent original Y)))
    (ly:grob-set-property!
 grob 'stencil
 (ly:stencil-add
  (ly:make-stencil
   (ly:stencil-expr (stencil-with-color
 (ly:round-filled-box
  (interval-widen X-ext X-padding)
  (interval-widen Y-ext Y-padding)
  1)
 yellow))
   empty-interval empty-interval)
  original
  #})

\new Staff \with {
  \markerPen Clef
}
\relative {
  c'4 d \once\markerPen 0.5 0.5 Accidental es fis
  \once \markerPen Staff.BarLine
  g \markerPen 0.5 0.5 NoteHead g a
}

While this does not solve the problem of the marking affecting 
inter-system spacing, at least it now works fine for accidentals.


Lukas




Re: Background Colour

2021-05-18 Thread Lukas-Fabian Moser

Hi Wim,

Am 18.05.21 um 14:07 schrieb Wim van Dommelen:
Seeing the discussion on coloured lyrics, colour this and that, I 
realized that for some parts I do change the Background Colour of the 
clefs maually (using a standard ofice yellow marking (grease) pencil 
each time after an update print. The purpose is to have a fast 
recognition point for the eyes to jump to the next line and/or page.


How about:

\version "2.19"

#(define (positive-number? x) (and (number? x) (positive? x)))

markerPen =
#(define-music-function (X-padding Y-padding grob-path) 
((positive-number? 0.5) (positive-number? 0) key-list?)

   #{
 \override #grob-path .layer = -1
 \override #grob-path .stencil =
 #(grob-transformer
   'stencil
   (lambda (grob default)
 (let ((X-ext (ly:stencil-extent default X))
   (Y-ext (ly:stencil-extent default Y)))
   (ly:stencil-add
    (ly:make-stencil
 (ly:stencil-expr  (stencil-with-color
    (ly:round-filled-box
 (interval-widen X-ext X-padding)
 (interval-widen Y-ext Y-padding)
 1)
    yellow))
 empty-interval empty-interval)
    default
   #})

\new Staff \with {
  \markerPen 0.5 Clef
}
\relative {
  c'4 d \markerPen 0.5 0.5 NoteHead es fis
  \once \markerPen Staff.BarLine
  \markerPen NoteHead
  \undo \markerPen NoteHead g a
}

I'm not really happy yet, though, because in some cases the marking 
affects the spacing. A positive value of Y-padding seems to influence 
the skylines (e.g. of a clef), so it moves the staves further apart; and 
for accidentals, the X-padding messes up the spacing completely. 
Probably I'm changing the stencil too early, it should be changed at a 
later stage after positioning.


Also, it's not really clean to force the grob and the marking onto the 
same layer.


Lukas




Re: Background Colour

2021-05-18 Thread darkijah

\relative c'' {
 a1 a  a
 % place in bottom layer
 -\tweak layer #-1
 -\markup {
   \with-dimensions #'(0 . 0) #'(0 . 0)
   % specify color
   \with-color #(rgb-color 1 0.5 0.5)
   % specify size
   \filled-box #'(-2 . 2) #'(-2 . 7) #0
 }
 a
}

Well on the background thing... I have no idea how to move it... But it 
is somewhat of the size that would be needed now I guess. But the other 
option of just coloring the Clef seems easier as far as I can see, if 
you need to used coordinate every single time to move it on the paper.


Is there a way to make a color glow from an image? :) I actually need 
something of that sort for the colored notes.


Dearly regards
Darkijah



Re: Background Colour

2021-05-18 Thread Pierre Perol-Schneider
Oops, sorry admin, sent again...

Le mar. 18 mai 2021 à 14:55, Pierre Perol-Schneider <
pierre.schneider.pa...@gmail.com> a écrit :

> Hi Wim,
> See: https://lsr.di.unimi.it/LSR/Item?id=699
> Cheers,
> Pierre
>
> Le mar. 18 mai 2021 à 14:30, Wim van Dommelen  a écrit :
>
>> Seeing the discussion on coloured lyrics, colour this and that, I
>> realized that for some parts I do change the Background Colour of the clefs
>> maually (using a standard ofice yellow marking (grease) pencil each time
>> after an update print. The purpose is to have a fast recognition point for
>> the eyes to jump to the next line and/or page.
>>
>> ...

> Is there also a possibility to automatically colour the background in
>> Lilypond, or is there a feature wishlist to which I could add this. A
>> variant marking a complete voice in another background colour or only the
>> clef(s) would probably also do.
>>
>> Regards,
>> Wim van Dommelen.
>>
>>
>>
>>


Re: Background Colour

2021-05-18 Thread darkijah

\version "2.22.1"
\relative d' {\override Staff.Clef.color = #red a b c d \break a b c d e 
}



\relative d' {a b c d \break a b c d e }


\relative d' {\once \override Staff.Clef.color = #red a b c d \break a b 
c d e }





Re: Background Colour

2021-05-18 Thread darkijah
Found the snippet and changed the colors so better to point it out - 
yet... that is as far as I can help.


\paper {
  indent = 0\mm
  line-width = 160\mm
  % offset the left padding, also add 1mm as lilypond creates cropped
  % images with a little space on the right
  line-width = #(- line-width (* mm  3.00) (* mm 1))
}

\layout {

}

% 
% ly snippet:
% 
\sourcefilename "snippets/adding-links-to-objects.ly"
\sourcefileline 0
%% DO NOT EDIT this file manually; it is automatically
%% generated from LSR http://lsr.di.unimi.it
%% Make any changes in LSR itself, or in Documentation/snippets/new/ ,
%% and then run scripts/auxiliar/makelsr.py
%%
%% This file is in the public domain.
\version "2.21.2"

\header {
%% Translation of GIT committish: 
f11513f36c131dab18338d6a3a729e24a927150d

  texidocja = "
grob-stencil ã«ãƒªãƒ³ã‚¯ã‚’è¿½åŠ ã™ã‚‹å 
´åˆã€ã“こに定義されている @code{add-link} ã‚’@c
使用することができます。@code{\\override} や @code{\\tweak} 
と動作します。@c
ただし、リンクが設定された Grob は @code{point-and-click} 
が無効になります。


制限: PDF でのみ動作します。

リンクされたオブジェクトに色が付いているのは、別のコマンドによるものです。
"
  doctitleja = "ã‚ªãƒ–ã‚¸ã‚§ã‚¯ãƒˆã«ãƒªãƒ³ã‚¯ã‚’è¿½åŠ ã™ã‚‹"

%% Translation of GIT committish: 
7a89226d5472a2548ec19228d8bccee1bd2480b4

  texidocfr = "
La fonction @code{add-link}, telle que définie ci-dessous, permet
d'ajouter un lien au stencil d'un objet graphique.  Elle s'emploie
au sein d'un @code{\\override} ou d'un @code{\\tweak}.

À noter que le fonctionnemment du @code{point-and-click} est perturbé
sur les objets ainsi liés.

Cette fonction n'est opérationnelle que pour une sortie PDF.

La coloration des objets liés s'obtient par une commande séparée.

"
  doctitlefr = "Ajout de liens à des objets"

%% Translation of GIT committish: 
7073ab2d033f82eb797d6fcefd3cd18c98fb3d63

  texidoces = "
Para añadir un enlace al sello de un objeto gráfico, podemos usar
@code{add-link} tal y como se define aquí.  FUnciona con
@code{\\override} y con @code{\\tweak}.  Inconveniente:
@code{point-and-click} (apuntar y pulsar) quedará obstacuilzado por
los objetos gráficos enlazados.

Limitación: funciona solamente para PDF.

Los objetos enlazados se colorean con una instrucción aparte.

"
  doctitlees = "Añadir enlaces a los objetos"

  lsrtags = "editorial-annotations, scheme-language, 
tweaks-and-overrides"


  texidoc = "
To add a link to a grob-stencil you could use @code{add-link} as
defined here. Works with @code{\\override} and @code{\\tweak}.

Drawback: @code{point-and-click} will be disturbed for the linked
grobs.

Limitation: Works for PDF only.

The linked objects are colored with a separate command.

"
  doctitle = "Adding links to objects"
} % begin verbatim

#(define (add-link url-strg)
  (lambda (grob)
(let* ((stil (ly:grob-property grob 'stencil)))
  (if (ly:stencil? stil)
(begin
  (let* (
 (x-ext (ly:stencil-extent stil X))
 (y-ext (ly:stencil-extent stil Y))
 (url-expr `(url-link url-strg ,x-ext ,y-ext))
 (new-stil (ly:stencil-add
 (ly:make-stencil url-expr x-ext y-ext) stil)))
  (ly:grob-set-property! grob 'stencil new-stil)))
#f

 test

urlI =
"https://lilypond.org/doc/v2.14/Documentation/notation/writing-pitches;

urlII =
"https://lilypond.org/doc/v2.14/Documentation/notation/rhythms;

urlIII =
"https://lilypond.org/doc/v2.14/Documentation/notation/note-heads;

urlIV =
"https://lilypond.org/doc/v2.14/Documentation/notation/beams;

urlV =
"https://lilypond.org/doc/v2.14/Documentation/notation/note-head-styles;

\relative c' {
  \key cis \minor

  \once \override Staff.Clef.color = #red
  \once \override Staff.Clef.after-line-breaking =
#(add-link urlI)

  \once \override Staff.TimeSignature.color = #orange
  \once \override Staff.TimeSignature.after-line-breaking =
#(add-link urlII)

  \once \override NoteHead.color = #yellow
  \once \override NoteHead.after-line-breaking =
#(add-link urlIII)

  cis'1
  \once \override Beam.color = #green
  \once \override Beam.after-line-breaking =
#(add-link urlIV)
  cis8 dis e fis gis2
 % With 2.17.9 you could use the command below to address the 
Accidental.

   % \tweak Accidental.before-line-breaking #(add-link url)
   \tweak color #blue
   \tweak after-line-breaking #(add-link urlV)
   \tweak style #'harmonic
   bis
   dis
   fis
  >1
  
}



% 
% end ly snippet
% 



Re: Background Colour

2021-05-18 Thread darkijah
As far as I recall you can color the symbol itself, I saw an example 
somewhere on it, although looking for the page myself.


I think it was the example page I saw it, although I don't have it at 
hand at the moment.


But I am sure someone knows :)

Dearly regards
- Darkijah



Re: background colour

2016-06-12 Thread Federico Bruni
Il giorno dom 12 giu 2016 alle 19:31, Malte Meyn 
 ha scritto:

Am 12.06.2016 um 16:31 schrieb Federico Bruni:

This is the "second part" not working? (commented code is helpful...)
I can't understand the error when I uncomment it,


There is no error. This is why one should look at the \version 
statement ;) Christian’s 2.18.2 works fine, your 2.19.xx (probably) 
not, because it would have to be

  system-system-spacing.basic-distance = 8
in the \paper block.


No, it was some other issue with scheme syntax, but I cannot reproduce 
it now (probably an error in copy).





___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: background colour

2016-06-12 Thread Malte Meyn



Am 12.06.2016 um 16:31 schrieb Federico Bruni:

This is the "second part" not working? (commented code is helpful...)
I can't understand the error when I uncomment it,


There is no error. This is why one should look at the \version statement 
;) Christian’s 2.18.2 works fine, your 2.19.xx (probably) not, because 
it would have to be

  system-system-spacing.basic-distance = 8
in the \paper block.


but this is an example
that works:

http://lists.gnu.org/archive/html/lilypond-user/2013-11/msg00849.html


This is the solution LSR snippets 443 (which Christian uses) and 699 
(which I suggested) give ;)


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: background colour

2016-06-12 Thread Klaus Blum
Hi Christian, 


Christian-186 wrote
> Does anybody know how to make the background black?

http://lsr.di.unimi.it/LSR/Item?id=969
<http://lsr.di.unimi.it/LSR/Item?id=969>   offers a colored background for
markups. 
You could modify it to produce a background in fixed dimensions:
%
-
\version "2.19.25"

#(define-markup-command (on-color layout props color arg) (color? markup?)
   (let* ((stencil (interpret-markup layout props arg))
  (X-ext (cons -200 200))
  (Y-ext (cons -200 200)))
 (ly:stencil-add (ly:make-stencil
  (list 'color color
(ly:stencil-expr (ly:round-filled-box X-ext Y-ext
0))
X-ext Y-ext)) stencil)))

\header {
  title = \markup \on-color #green "This is the title"
}

\score { \repeat unfold 20 { c' d' e' f'} }
%
-

If your score contains more than one page, one could apply similar things to
e.g. the page numbers. 
Unlike  http://lsr.di.unimi.it/LSR/Item?id=699
<http://lsr.di.unimi.it/LSR/Item?id=699>  , the background rectangle would
not cover the header area. 

Cheers, 
Klaus



--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/background-colour-tp191554p191568.html
Sent from the User mailing list archive at Nabble.com.

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: background colour

2016-06-12 Thread Federico Bruni
Il giorno dom 12 giu 2016 alle 13:00, Christian 
 ha scritto:

Hi all,

I am trying to make a reverted score (white music on black 
background).

The first part works, the second doesn't.
Does anybody know how to make the background black?

#(define (override-color-for-all-grobs color)
   (lambda (context)
 (let loop ((x all-grob-descriptions))
   (if (not (null? x))
   (let ((grob-name (caar x)))
 (ly:context-pushpop-property context grob-name 'color 
color)

 (loop (cdr x)))

\version "2.18.2"

\header {
  % Standaard LilyPond-tagline verwijderen
  tagline = ##f
}


global = {
  \key e \minor
}

nl = {
  \bar "" \break
}

sopranoVoice = \relative c' {
  \global
 c2 g
}

verse = \lyricmode {
  \set stanza = "1."
  ly -- rics
}

\score {
  \new Staff \with {
midiInstrument = "choir aahs"
  } { \sopranoVoice }
  \addlyrics { \verse }
  \layout {
\context {
  \Score
  %\applyContext #(override-color-for-all-grobs (x11-color 
'white))


This is the "second part" not working? (commented code is helpful...)
I can't understand the error when I uncomment it, but this is an 
example that works:


http://lists.gnu.org/archive/html/lilypond-user/2013-11/msg00849.html

(did you take the code from there?)



  \remove Bar_number_engraver
}
\context {
  \Lyrics
  \override LyricText #'font-size = #3
  \override LyricText #'font-name = #"Plantin MT Std"
}
  }
}

\paper {
  indent = 0 % don't indent first system
  left-margin = 60
  right-margin = 60

  system-system-spacing #'basic-distance = #8
  score-system-spacing =
  #'((basic-distance . 12)
 (minimum-distance . 6)
 (padding . 1)
 (stretchability . 12))

}

#(set-global-staff-size 15)


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user



___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: background colour

2016-06-12 Thread David Wright
On Sun 12 Jun 2016 at 11:00:13 (+), Christian wrote:
> I am trying to make a reverted score (white music on black background).
> The first part works, the second doesn't.
> Does anybody know how to make the background black?

Displaying the PDF in reverse-video is not sufficient, I assume.
(That complements any colours too.)

Cheers,
David.

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: background colour

2016-06-12 Thread Malte Meyn



Am 12.06.2016 um 13:00 schrieb Christian:

Hi all,

I am trying to make a reverted score (white music on black background).
The first part works, the second doesn't.
Does anybody know how to make the background black?


See http://lsr.di.unimi.it/LSR/Item?id=699

sopranoVoice = \relative c' {
  \global
  c2 g
  -\tweak layer #-1
  -\markup {
\with-dimensions #'(0 . 0) #'(0 . 0)
\with-color #black
\filled-box #'(-1000 . 1000) #'(-1000 . 4000) #0
  }
}

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


background colour

2016-06-12 Thread Christian
Hi all,

I am trying to make a reverted score (white music on black background).
The first part works, the second doesn't.
Does anybody know how to make the background black?

#(define (override-color-for-all-grobs color)
   (lambda (context)
 (let loop ((x all-grob-descriptions))
   (if (not (null? x))
   (let ((grob-name (caar x)))
 (ly:context-pushpop-property context grob-name 'color color)
 (loop (cdr x)))

\version "2.18.2"

\header {
  % Standaard LilyPond-tagline verwijderen
  tagline = ##f
}


global = {
  \key e \minor
}

nl = {
  \bar "" \break
}

sopranoVoice = \relative c' {
  \global
 c2 g
}

verse = \lyricmode {
  \set stanza = "1."
  ly -- rics
}

\score {
  \new Staff \with {
midiInstrument = "choir aahs"
  } { \sopranoVoice }
  \addlyrics { \verse }
  \layout {
\context {
  \Score
  %\applyContext #(override-color-for-all-grobs (x11-color 'white))
  \remove Bar_number_engraver
}
\context {
  \Lyrics
  \override LyricText #'font-size = #3
  \override LyricText #'font-name = #"Plantin MT Std"
}
  }
}

\paper {
  indent = 0 % don't indent first system
  left-margin = 60
  right-margin = 60

  system-system-spacing #'basic-distance = #8
  score-system-spacing =
  #'((basic-distance . 12)
 (minimum-distance . 6)
 (padding . 1)
 (stretchability . 12))

}

#(set-global-staff-size 15)


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user