Piano keys: add subtle vertical gradient for 3D appearance

This commit is contained in:
Armin 2026-07-13 22:40:43 +02:00
commit 827eca7e61

View file

@ -838,10 +838,13 @@ void PianoRollComponent::paint(juce::Graphics& g) {
auto rect = juce::Rectangle<int>(kx, 0, whiteKeyWidth - 1, whiteKeyHeight); auto rect = juce::Rectangle<int>(kx, 0, whiteKeyWidth - 1, whiteKeyHeight);
bool pressed = processor.isNoteActive(note); bool pressed = processor.isNoteActive(note);
if (pressed) if (pressed) {
g.setColour(juce::Colour(0xffccaa44)); g.setColour(juce::Colour(0xffccaa44));
else } else {
g.setColour(juce::Colour(0xffdddddd)); juce::ColourGradient grad(juce::Colour(0xffe4e4e4), static_cast<float>(kx), 0.0f,
juce::Colour(0xffc8c8c8), static_cast<float>(kx), static_cast<float>(whiteKeyHeight), false);
g.setGradientFill(grad);
}
g.fillRect(rect); g.fillRect(rect);
g.setColour(juce::Colour(0xff555555)); g.setColour(juce::Colour(0xff555555));
@ -872,10 +875,13 @@ void PianoRollComponent::paint(juce::Graphics& g) {
auto rect = juce::Rectangle<int>(static_cast<int>(bx), 0, blackKeyWidth, blackKeyHeight); auto rect = juce::Rectangle<int>(static_cast<int>(bx), 0, blackKeyWidth, blackKeyHeight);
bool pressed = processor.isNoteActive(note); bool pressed = processor.isNoteActive(note);
if (pressed) if (pressed) {
g.setColour(juce::Colour(0xffccaa44)); g.setColour(juce::Colour(0xffccaa44));
else } else {
g.setColour(juce::Colour(0xff333333)); juce::ColourGradient grad(juce::Colour(0xff444444), static_cast<float>(bx), 0.0f,
juce::Colour(0xff222222), static_cast<float>(bx), static_cast<float>(blackKeyHeight), false);
g.setGradientFill(grad);
}
g.fillRect(rect); g.fillRect(rect);
g.setColour(juce::Colour(0xff555555)); g.setColour(juce::Colour(0xff555555));