[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Setting default arguments for music function?
From: |
Jean Abou Samra |
Subject: |
Re: Setting default arguments for music function? |
Date: |
Wed, 1 Feb 2023 01:08:49 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 |
On 01/02/2023 01:04, Ahanu Banerjee wrote:
> Is it possible to specify default values for a function to use when arguments
> are missing? In the example below, I want the default font size to be -4 and
> the default color to be blue without having to specify it each time, but I
> also want the ability to change those values in rare cases.
>
> \version "2.24"
> \language "english"
> altParen = #(define-music-function
> (parenColor parenSize parenItem)
> (color? number? ly:music?)
> #{
> \tweak Parentheses.font-size #parenSize \tweak Parentheses.color
> #parenColor \parenthesize #parenItem
> #})
> { c \altParen "blue" #-4 \upbow }
Perhaps read this:
https://extending-lilypond.readthedocs.io/en/latest/extending/music.html#optional-arguments
Best,
Jean
OpenPGP_signature
Description: OpenPGP digital signature