[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Color of notes depending on accidentals
From: |
Gilles THIBAULT |
Subject: |
Re: Color of notes depending on accidentals |
Date: |
Thu, 26 Feb 2009 01:45:21 +0100 |
Is there is a way to authomatically color notes that are e.g. sharp?
This function colories in red all "sharped" notes :
%%%%%%%%%%%%%%%%%%%%%%%%%%%
#(define (is-sharped? note)
(let ((p (ly:music-property note 'pitch)))
(and
(ly:pitch? p)
(equal? (ly:pitch-alteration p) SHARP))))
colorSharp = #(define-music-function (parser location music )(ly:music?)
(music-map
(lambda (evt)
(if (eq? 'EventChord (ly:music-property evt 'name))
(map
(lambda (note)
(if (is-sharped? note)
(ly:music-set-property! note 'tweaks
(list (list 'color 1.0 0.0 0.0)))
note))
(ly:music-property evt 'elements)))
evt)
music
))
music = \relative {
c4 cis d e f fis g aes g f! dis e c1 }
\new Staff \colorSharp \music
%%%%%%%%%%%%%%%%%%%%%
Gilles