Add infrastructure and settings for controlling the Review Board theme.

Review Request #13724 — Created April 10, 2024 and submitted

Information

Review Board
release-7.x

Reviewers

Review Board 7 introduces the beginnings of theme support. We'll be
supporting Light, Dark, and System (Auto Light/Dark) themes, but the
idea is to later allow for the possibility of more flexibility here
(such as High Contrast and maybe even custom themes).

Users can make their choice in My Account -> Appearance. The default is
the traditional Light Mode, with all other modes listed as Beta.
Eventually, once Dark Mode is stabilized, the plan is to set System as
the default. For this reason, "default" is a mode of its own, mapping
internally to the default mode. A siteconfig setting can be specified to
choose a custom default.

Internally, this is all backed by a new app module:
reviewboard.themes. This contains a sub-module,
reviewboard.themes.ui, which defines a BaseUITheme, each theme
implementation, and a UIThemeRegistry. These are picked up by the form
and used to offer selections. The theme classes supply attributes for
the <html> tag to enable Ink theme selection.

This is one half of the theme implementation. The second part will
introduce syntax highlighting themes.

Unit tests pass.

Tested all the themes, making sure they applied, set the right
attributes, and took effect.

Summary ID
Add infrastructure and settings for controlling the Review Board theme.
Review Board 7 introduces the beginnings of theme support. We'll be supporting Light, Dark, and System (Auto Light/Dark) themes, but the idea is to later allow for the possibility of more flexibility here (such as High Contrast and maybe even custom themes). Users can make their choice in My Account -> Appearance. The default is the traditional Light Mode, with all other modes listed as Beta. Eventually, once Dark Mode is stabilized, the plan is to set System as the default. For this reason, "default" is a mode of its own, mapping internally to the default mode. A siteconfig setting can be specified to choose a custom default. Internally, this is all backed by a new app module: `reviewboard.themes`. This contains a sub-module, `reviewboard.themes.ui`, which defines a `BaseUITheme`, each theme implementation, and a `UIThemeRegistry`. These are picked up by the form and used to offer selections. The theme classes supply attributes for the `<html>` tag to enable Ink theme selection. This is one half of the theme implementation. The second part will introduce syntax highlighting themes.
da7e15615fdc3b852351532b953841bfc8b3a77e

Description From Last Updated

Rather than have a new page for this, I feel like we should rearrange the existing "Settings" page a bit: …

daviddavid
chipx86
maubin
  1. Ship It!
  2. 
      
maubin
  1. Meant to ask this in my last review -- do the themes apply right away when selecting them on the form? Or do they only apply after saving the form? It would be nice to show a preview of the selected theme somehow, by having the theme apply to the page right away when selecting it. Or you could show a little picture of the theme similar to how GitHub does.

    1. They only apply when saving the form. There's no time right now to do anything more than this right now, but I have a better theme UI planned post-release.

    2. Sounds good.

  2. 
      
david
  1. 
      
  2. Show all issues

    Rather than have a new page for this, I feel like we should rearrange the existing "Settings" page a bit:

    Appearance

    (o) Default appearance (Light mode)
    ( ) Dark mode (beta)
    ( ) Use system theme (beta)

    [x] Enable syntax highlighting for the diff viewer

    General Settings

    Time Zone

    [x] Always open an issue when the comment box opens
    [x] Always use markdown for text fields

    Notifications

    ...

    1. I'd like to have a new page for this.

      Settings itself has too much cruft, and I have longer-term plans for Appearance that would benefit from having breathing room.

      This is also not the only setting coming. There's a part 2 for this change in my tree, and a part 3 prototyped for RB8 that will require even more room available.

    2. Can we move this page to not be the first thing in the list, then? I think the profile/general settings are more important.

  3. 
      
chipx86
david
  1. Ship It!
  2. 
      
maubin
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-7.x (d4d8d3f)