tweak

abjad.top.tweak.tweak(argument)

Makes LilyPond tweak manager.

Tweaks markup:

>>> staff = abjad.Staff("c'4 d' e' f'")
>>> markup = abjad.Markup('Allegro assai', direction=abjad.Up)
>>> abjad.tweak(markup).color = 'red'
>>> abjad.attach(markup, staff[0])
>>> abjad.show(staff) 

Survives copy:

>>> import copy
>>> staff = abjad.Staff("c'4 d' e' f'")
>>> markup_1 = abjad.Markup('Allegro assai', direction=abjad.Up)
>>> abjad.tweak(markup_1).color = 'red'
>>> markup_2 = copy.copy(markup_1)
>>> abjad.attach(markup_2, staff[0])
>>> abjad.show(staff) 

Survives dot-chaining:

>>> staff = abjad.Staff("c'4 d' e' f'")
>>> markup = abjad.Markup('Allegro assai', direction=abjad.Up)
>>> abjad.tweak(markup).color = 'red'
>>> markup = markup.italic()
>>> abjad.attach(markup, staff[0])
>>> abjad.show(staff) 

Works for opposite-directed coincident markup:

>>> staff = abjad.Staff("c'4 d' e' f'")
>>> markup_1 = abjad.Markup('Allegro assai ...', direction=abjad.Up)
>>> abjad.tweak(markup_1).color = 'red'
>>> abjad.attach(markup_1, staff[0])
>>> markup_2 = abjad.Markup('... ma non troppo', direction=abjad.Down)
>>> abjad.tweak(markup_2).color = 'blue'
>>> abjad.tweak(markup_2).staff_padding = 4
>>> abjad.attach(markup_2, staff[0])
>>> abjad.show(staff) 

Ignored for same-directed coincident markup:

>>> staff = abjad.Staff("c'4 d' e' f'")
>>> markup_1 = abjad.Markup('Allegro assai ...', direction=abjad.Up)
>>> abjad.tweak(markup_1).color = 'red'
>>> abjad.attach(markup_1, staff[0])
>>> markup_2 = abjad.Markup('... ma non troppo', direction=abjad.Up)
>>> abjad.tweak(markup_2).color = 'blue'
>>> abjad.tweak(markup_2).staff_padding = 4
>>> abjad.attach(markup_2, staff[0])
>>> abjad.show(staff) 

Tweaks note-head:

>>> staff = abjad.Staff("c'4 cs' d' ds'")
>>> abjad.tweak(staff[1].note_head).color = 'red'
>>> abjad.show(staff) 

Tweaks grob aggregated to note-head:

>>> staff = abjad.Staff("c'4 cs' d' ds'")
>>> abjad.tweak(staff[1].note_head).accidental.color = 'red'
>>> abjad.show(staff) 

Returns LilyPond tweak manager:

>>> abjad.tweak(markup_1)
LilyPondTweakManager(('color', 'red'))

Tweak expressions work like this:

>>> abjad.tweak('red').color
LilyPondTweakManager(('color', 'red'))
>>> abjad.tweak(6).Y_offset
LilyPondTweakManager(('Y_offset', 6))
>>> abjad.tweak(False).bound_details__left_broken__text
LilyPondTweakManager(('bound_details__left_broken__text', False))