AudioKit / Keyboard

SwiftUI music keyboard
MIT License
137 stars 25 forks source link

Keyboard key color #3

Closed NickCulbertson closed 2 years ago

NickCulbertson commented 2 years ago

This PR adds the ability to change the key colors, option to leave the top key corners flat, adds a range control to the demo, & adds the boarder spacing back in.

White keys will again blend with a white backgrounds. If this is an issue, developers can add .background(.black).cornerRadius(5) to pop it off the background.

Here is an example key styling

//Add Custom KeyboardKey Style
                Keyboard(pitchRange: Note(.C, octave: octave).pitch...Note(.C, octave: octave + range).pitch,
                         noteOn: noteOn, noteOff: noteOff){ pitch, isActivated in
                    KeyboardKey(pitch: pitch,
                                isActivated: isActivated,
                                text: "",
                                whiteKeyColor: Color.purple,
                                blackKeyColor: Color.black,
                                pressedColor: Color.pink,
                                flatTop: true)
                }.cornerRadius(5)
aure commented 2 years ago

@NickCulbertson The only change to this I plan to make is to remove flatTop as a parameter and just use have our pianos have a flat top by default. It looks a little better that way and we don't want to have this grow to every option under the sun. The point is to give good defaults and let the user use their own custom keyboard view for more complex cases.

NickCulbertson commented 2 years ago

@aure Sounds good! It looks nice being flat across the default keys but I wasn't sure about the isomorphic layout.

aure commented 2 years ago

@NickCulbertson yeah only on piano