private void paintMacThumb(Graphics g, Rectangle thumbBounds) {
if (isMacScrollbarHiddenAndXcodeLikeScrollbar()) return;
thumbBounds = getMacScrollBarBounds(thumbBounds, true);
Graphics2D g2d = (Graphics2D)g;
if (Registry.is("mac.scroll.new.ui")) {
float value = (float)(1 - myMacScrollbarFadeLevel);
if (!myMacScrollbarHidden || alwaysPaintThumb()) {
RegionPainter<Float> painter = isDark() ? JBScrollPane.MAC_THUMB_DARK_PAINTER : JBScrollPane.MAC_THUMB_PAINTER;
painter.paint(g2d, thumbBounds.x - 2, thumbBounds.y - 2, thumbBounds.width + 4, thumbBounds.height + 4, value);
}
return;
}
RenderingHints oldHints = g2d.getRenderingHints();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
JBColor baseColor = new JBColor(() -> !isDark() ? com.intellij.ui.Gray._0 : com.intellij.ui.Gray._128);
int arc = Math.min(thumbBounds.width, thumbBounds.height);
if (alwaysPaintThumb()) {
g2d.setColor(new Color(baseColor.getRed(), baseColor.getGreen(), baseColor.getBlue(), isDark() ? 100 : 40));
g2d.fillRoundRect(thumbBounds.x, thumbBounds.y, thumbBounds.width, thumbBounds.height, arc, arc);
}
if (!myMacScrollbarHidden) {
g2d.setColor(adjustColor(baseColor));
g2d.fillRoundRect(thumbBounds.x, thumbBounds.y, thumbBounds.width, thumbBounds.height, arc, arc);
}
g2d.setRenderingHints(oldHints);
}