Page MenuHomePhabricator

[Spike] How should we make computer code legible in dark-mode?
Closed, DuplicatePublic

Description

Background

Currently, highlighted computer code displays white-on-white text in dark-mode. The purpose of this task is to determine how we can make highlighted computer code compatible with dark-mode. e.g. https://en.wikipedia.org/wiki/Functional_programming?vectornightmode=1

Screenshot 2024-05-30 at 10.09.48 AM.png (2,446×1,466 px, 330 KB)
Screenshot 2024-05-30 at 10.10.05 AM.png (2,446×1,466 px, 313 KB)
code in light-modecode in dark-mode

there are actually four types of potential computer code generated by wikitext:

  • Blocks of syntax highlighted code
  • Blocks of preformatted text (<pre> tags, works in dark-mode)
  • Inline syntax highlighted code
  • Inline preformatted text (<code> tags, works in dark-mode)

User story

As someone reading Wikipedia in dark-mode, I expect highlighted computer code to be legible in dark-mode. Ideally, I expect the look of computer code to match the rest of the dark-mode color palette.

Requirements

Determine how we can make computer code legible in dark-mode. Text should not appear white-on-white or black-on-black.

Acceptance criteria

Open questions:

  • How does code syntax highlighting even work in Mediawiki? Do we use a third-party library?
  • If we are using a third-party library for syntax highlighting:
    • Does the library support theming?
    • Is there an existing dark theme we could use for syntax highlighting?
    • How can we apply that theme to our version of dark mode?
  • What's the simplest way we can achieve legibility for computer code? Should we apply a .notheme or .skin-invert class to it?

This task was created by Version 1.0.0 of the Web team task template using phabulous