Skip to content

Adapt scrollbar to terminal color scheme for Breeze widget style again

snooxx 💤 requested to merge (removed):scrollbar into release/21.12

2a71f063 changed the scrollbar background to match the terminal color scheme. This looks fine for the Breeze widget style, but fails for non-Breeze styles such as Fusion or Plastique. Sometimes scrollbars would be only barely visible, in other cases the scrollbar would look really out of place (e.g. very dark scrollbar on white terminal background with light widget colors).

92e19c63 then unconditionally removed the color matching functionality, so scrollbars would always use the (as of dc8ad830 application-specific) widget color scheme. This solves the accessibily issues, but might be considered a step backwards for Breeze trying to blend into the app's content.

In !402 (closed) adding a configuration toggle to let users disable color matching was turned down. Instead, automatically switching behavior depending on the current widget style was suggested. Obviously this is less than ideal from a maintenance perspective and might look like magic for users, but seems like the best option left at this point.

After this patch, Breeze users will get scrollbar colors matched to the terminal color scheme as intended in 2a71f063. Scrollbars of non-Breeze users will be colored according to the widget color scheme as implemented in 92e19c63, which is also how it looked before 2a71f063 landed. Changing widget styles at runtime is fully supported.

Implementation-wise, note that MenuStyle is a QProxyStyle applied to the whole application, which slightly affects how to determine the current widget style in use.

In the future, styles shall only be added to the allowlist if they look good with both light and dark terminal background colors (e.g Fusion currently does not qualify, because while the scrollbar might look acceptable with a dark background, the coloring algorithm in Konsole does not provide adequate scrollbar coloring with light backgrounds).

Test Plan:

  • start Konsole with Breeze widget style
  • change background color in terminal profile from black to white: scrollbar color should match terminal background
  • change application color scheme from light to dark: scrollbar color should be unaffected
  • change widget style to Fusion in "kcmshell5 kcm_style"
  • change background color in terminal profile from white to black: scrollbar color should be unaffected
  • change application color scheme from dark to light: scrollbar color should match widget colors

(The last step will only work without restarting Konsole once the third patch in this series has been applied.)

Commits contained in this MR: 3e652002, 8d2582b0, 564ae1fa

Edited by snooxx 💤

Merge request reports