lilypond-user-fr
[Top][All Lists]
Advanced

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

Re: couleurs rgb


From: Gilles THIBAULT
Subject: Re: couleurs rgb
Date: Fri, 27 Mar 2015 13:48:15 +0100
User-agent: KMail/4.12.5 (Linux/3.14.32-desktop-1.mga4; KDE/4.12.5; x86_64; ; )

 
> mkRGB = #(define-scheme-function (parser location lst) (list?)
>  (define (convert-rgb n) (if (> n 0) (exact->inexact(/ (+ 1 n) 256)) 0 ))
>  (map convert-rgb lst)
>  (append '(rgb-color) lst)
>  lst
> )
> 
> #(define lst '(0 128 256))
> (display (mkRGB test))
la syntaxe serait plutôt :

%%%%%%%%%%
mkRGB = #(define-scheme-function (parser location lst) (list?)
 (define (convert-rgb n) (if (> n 0) (exact->inexact(/ (+ 1 n) 256)) 0 ))
 (apply rgb-color (map convert-rgb lst))
)

#(display #{ \mkRGB #'(0 128 256) #})

%%%%%%%%%

En scheme brut/pure/classique ..., c'est plus simple :

%%%%%%%%%%%%%%%
#(define (mkRGB . args)
   (define (convert-rgb n) (/ n 256)) 
(apply rgb-color (map convert-rgb args)))
%% (apply fonc '(a b c d ..) => (fonc a b c d ..)

#(display (mkRGB 0 127 256))

\relative c' { 
  \override NoteHead.color = #(mkRGB 0 128 256) 
  c4 d e f
}

%%%%%%%%%%%%%%%%%%%

NB
 J'ai mis (/ n 256) qui marche très bien, mais je ne suis pas spécialiste des 
couleurs.

%%%%%%%
-- 
Gilles



reply via email to

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