Re: Coloring notes played on black piano key AND coloring accidental and key signature notes with different colors

2019-01-18 Thread Barbara Mroczek
I don't see any answer, so here are my two cents.
Here you can find snippet, that colors note heads depending on their
pitch and name:
http://lilypond.org/doc/v2.12/input/lsr/lilypond-snippets/Pitches#Color
ing-notes-depending-on-their-pitch
All you need to do is modify the list associating pitches (names) with
colors. Pitches are described using ly:make-pitch, which description
you will find here:
http://lilypond.org/doc/v2.18/Documentation/internals/scheme-functions
As I understand, you want all pitches from key signature blue and the
rest of non-natural pitches red.
Hth,
Basia
On pią, 2019-01-11 at 13:08 +0100, Pierre-Emile LHUILLIER wrote:
> Dear all,
>  
> Could you help me achieving the following objectives :
>  
> 1)  In a piano staff, I would like to color (in blue) the notes
> that are played on the black piano keys
> And if possible :
> 2)  I would like to color differently the note that are played on
> a black piano keys because of the key signature (in blue) from the
> notes that are played on black piano keys because of accidentals (in
> red)
>  
> Best regards
> 
> Pierre-Emile
> ___
> 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


Coloring notes played on black piano key AND coloring accidental and key signature notes with different colors

2019-01-11 Thread Pierre-Emile LHUILLIER
Dear all,



Could you help me achieving the following objectives :



1)  In a piano staff, I would like to color (in blue) the notes that
are played on the black piano keys

And if possible :

2)  I would like to color differently the note that are played on a
black piano keys because of the key signature (in blue) from the notes that
are played on black piano keys because of accidentals (in red)



Best regards


Pierre-Emile
\version "2.10.16"

#(ly:set-option 'point-and-click #f)
#(set-default-paper-size "a4" )
#(set-global-staff-size 20 )

\header
{
	title = "Sonata No. 14, 'Moonlight'"
	composer = "Ludwig van Beethoven"
	opus = "Op. 27, No. 2"
	piece = \markup { \bold "Adagio sostenuto" }

	mutopiatitle = "Sonata No. 14 “Moonlight” (1st Movement: Adagio sostenuto)"
	mutopiacomposer = "BeethovenLv"
	mutopiainstrument = "Piano"
	date = "1802"
	source = "Berners, 1908 (edited by A. Winterberger)"
	style = "Classical"
	mutopiacopyright = "Creative Commons Attribution-ShareAlike 2.5"

	maintainer = "Stewart Holmes"
	maintainerEmail = "stew...@stewartholmes.com"
	maintainerWeb = "www.stewartholmes.com"
	lastupdated = "2007/Feb/11"

	copyright = \markup { \teeny \center-align { "Copyright © 2007" "Licensed under the Creative Commons Attribution-ShareAlike 2.5 License" "http://creativecommons.org/licenses/by-sa/2.5."; } }
	footer = "Mutopia-2007/02/11-276"
	tagline = ""
}

down =
{
	\change Staff = "down"
}
up =
{
	\change Staff = "up"
}

moveFingering = #(define-music-function (parser location shift) (pair?)
#{
	\once \override Fingering #'extra-offset = $shift
#})

moveText = #(define-music-function (parser location shift) (pair?)
#{
	\once \override TextScript #'extra-offset = $shift
#})

movePhrasingSlur = #(define-music-function (parser location shift) (pair?)
#{
	\once \override PhrasingSlur #'extra-offset = $shift
#})

fingerscript =
{
	\once \override TextScript #'font-size = #-5
	\once \override TextScript #'font-encoding = #'fetaNumber
}

topmain =  \relative c'
{
	\key e \major
	\time 2/2
	\clef treble
	\stemUp
	
	s1*4			%1
	s2 r4 gis'8.^\pp gis16 |	%5
	gis2. gis8. gis16 |
	\movePhrasingSlur #'(0 . 2) \fingerscript \moveText #'(0 . 1.5) gis2-"5 - 4" \(a2-5 |
	\fingerscript \moveText #'(0 . -1) gis2-"4 - 5" fis4-4 \moveFingering #'(0 . 2) b-5\) |
	e,-3 r r2 |		%9
	r r4 g8. g16 |
	g2. g8. g16 |
	g2. \(fis4-4\) |
	\fingerscript fis2-"5 - 4" \(\moveFingering #'(0 . 1) g4-5 \moveFingering #'(0 . 0.5) e-4\) |		%13
	fis2-5 fis |
	b,4 r r 
	%\once \override PhrasingSlur #'control-points = #'((0 . 0) (3 . 5) (6 . 5) (10 . 0)) 
	\fingerscript 
	
	
	\override PhrasingSlur #'extra-offset = #'(0 . 2)
	%\override PhrasingSlur #'after-line-breaking = #pagebreakone
	\moveText #'(0 . 1.2) b'-"5 - 4" \( |  
	
	\revert PhrasingSlur #'extra-offset
	
	c2.-5 ais4-4\) |
	b2.-5 \fingerscript \moveFingering #'(-0.1 . -0.15) b4-"5 - 4" \( |		%17
	\moveFingering #'(0 . 1.3) c2.-5 ais4-4\) |
	b2-5 \(b |
	b \fingerscript a-"4 - 5"\) |
	\fingerscript g-"4 - 5" \fingerscript fis-"4 - 5" |		%21
	\fingerscript cis-"3 - 5" cis4 cis |
	\down
	fis,-1
	\up
	r r cis''8. cis16 |
	cis2. cis8. cis16 |
	cis2 \(bis4 cis-4\) |	%25
	dis2.-5 \fingerscript dis4-"5 - 4" |
	e2-5 \(\fingerscript dis4-"4 - 5" \fingerscript cis-"4 - 5"\) |
	s-\p \moveFingering #'(0 . 0.5) gis-4 \(\moveFingering #'(0 . 1) a-5 \moveFingering #'(0 . 1) fis-3\) |
	s gis, \(a fis\) |		%29
	s cis''-4 \(e cis\) |
	\down
	s cis,-4 \(e cis\) |
	\up
	s1*2 |			%33
	s1*3 |
	\stemDown
	\phrasingSlurDown
	s4 \clef bass s4 a8*2/3 dis,4*2/3 \(cis4 |	%37
	bis2\) dis4 \(\moveText #'(0.9 . -6) \fingerscript cis-"1 - 2" |
	bis2\) \moveText #'(-1 . -7) \fingerscript d4-"2 - 1" \(\moveFingering #'(-0.15 . -0.1) cis-2 |
	bis2_\markup {\italic "decresc."}\) s2 |
	s1 |			%41
	\stemUp
	s4 \clef treble s s gis''8.^\pp gis16 |
	gis2. gis8. gis16 |
	\phrasingSlurUp
	\fingerscript gis2-"5 - 4" \(\moveFingering #'(0 . 1.1) a-5 |
	\fingerscript gis-"4 - 5" \moveFingering #'(0 . 1.6) fis4-4 b4-5\) |		%45
	e,-3 r r b'8. b16 |
	b2. b8. b16 |
	\fingerscript b2-"5 - 4" \(\moveFingering #'(0 . 1.1) bis4-5 cis-4\) |
	\fingerscript dis2-"5 - 4" \(\moveFingering #'(0 . 1.1) e-5 |		%49
	\fingerscript d-"4 - 5" \fingerscript bis-"4 - 5"\) |
	cis2.-5 \fingerscript cis4-"5 - 4" \( | 
	\moveFingering #'(0 . 1) d2.-5 bis4-4\) |
	cis2.-5 cis4 \( |	%53
	d2. bis4\) | 
	cis2 cis |
	b!2. b4 |
	a-4 a-5 gis-4 gis-5 | 	%57
	fis2-4_\markup {\italic "cresc."} \(\fingerscript gis4-"5 - 4" a-5\) |
	\fingerscript gis2-"4 - 5"-\p gis-5 |
	cis,4-3 s s2 | 
	s1 |			%61
	s1 |
	s2 \clef bass s4 \moveFingering #'(0 . 1) bis4-5 | 
	s8*2/3 \clef treble s4*2/3 s2. |
	s2 \clef bass s4 bis4-5 | 		%65
	s1 |
	s2 d,\rest |
	d\rest -\pp |
	1^\fermata |			%69
	
	\stemNeutral
	\bar "|."
}

topsecondary =  \relative c'
{
	#(override-auto-beam-setting '(end * * * *)  1 4)
	#(override-auto-beam-setting '(end * * * *)  2 4)
	#(override-auto-beam-setting '(end * * * *)  3 4)
	
	\set tupletSpannerDuration = #(ly:make-moment 1 4)
	
	\set f