Skip to content

Problems in Windows contrast themes #19833

Todo

Description

@gtritchie

This issue tracks problems with Windows contrast themes (CSS forced colors mode). It starts with one finding. More will be added after an audit of RStudio under contrast themes.

Related issues

System details

RStudio Edition : Desktop or Server
RStudio Version : with #19832
OS Version      : Windows 11
R Version       : any

Split buttons' two halves can't be told apart

#19832 draws the menu half of a split button (such as the Open button's recent files in the main toolbar) as a chevron, set off from its button by a hairline. Toolbar buttons are also shaded on hover. In a contrast theme, neither shows:

  • The hairline is the background-color of a ::before pseudo-element (.toolbarButtonMenuOnly:before in themeStyles.css). Forced colors replaces it with the theme's Canvas colour, keeping its 20% alpha, so it disappears against the toolbar.
  • The hover and pressed shades are linear-gradient background images, which forced colors sets to none.

Measured in Chromium with forced colors emulated (page.emulateMedia({ forcedColors: 'active' })), not yet on Windows:

Off Forced colors
Hairline colour rgba(0, 0, 0, 0.2) rgba(255, 255, 255, 0.2) on a white toolbar
Hovered button's background image linear-gradient(rgba(0, 0, 0, 0.08), ...) none

Notes on fixing

  • Drawing the hairline as a 1px border-left would let forced colors map it to a visible system colour.
  • A hover style for contrast themes needs a @media (forced-colors: active) block. As the comment above the @supports block in themeStyles.css explains, such a block has to be passed through GWT unparsed, and only @external class names can be used inside it. .toolbar and .toolbarButton are obfuscated, so this needs either external class names on toolbar buttons or a class set from Java.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions