Skip to content

feat(EmptyState): Invert empty state illustrations in dark mode

What does this MR do?

Inverts empty state illustrations in dark mode.

Adds a .gl-dark-invert-keep-hue util class, which inverts and rotates hue (to keep similarish colors).

Includes a invertInDarkMode prop to opt out, in case you are using an illustration that already supports dark mode (either using CSS vars or transparent background).

Does this MR meet the acceptance criteria?

View demo (only illustration color changes, not text) from !2704 (closed) - http://psi-temp.64.227.120.153.nip.io/?path=/story/regions-empty-state--default

made these by editing storybook html, adding gl-dark class to the container and setting background to #1f1f1f.

before after
Screen_Shot_2022-03-07_at_10.03.35_pm Screen_Shot_2022-03-07_at_10.03.26_pm

Here is scrolling through the current set of 245 illustrations with some extra CSS

current inverted
dark-ill-before dark-ill-after

Conformity

  • Code review guidelines.
  • GitLab UI's contributing guidlines.
  • If it changes a Pajamas-compliant component's look & feel, the MR has been reviewed by a UX designer.
  • If it changes GitLab UI's documentation guidelines, the MR has been reviewed by a Technical Writer.
  • If the MR changes a component's API, integration MR(s) have been opened in the following projects to ensure that the @gitlab/ui package can be upgraded quickly after the changes are released:
  • Added the ~"component:*" label(s) if applicable.

Docs

Maybe add this to component readme

### Dark mode

GlEmptyState tries to automatically darken illustrations in dark mode.

To prevent this behavior, set the `invertInDarkMode` prop to `false`.

Accessibility

If this MR adds or modifies a component, take a few moments to review the following:

  • All actions and functionality can be done with a keyboard.
  • Links, buttons, and controls have a visible focus state.
  • All content is presented in text or with a text equivalent. For example, alt text for SVG, or aria-label for icons that have meaning or perform actions.
  • Changes in a component’s state are announced by a screen reader. For example, changing aria-expanded="false" to aria-expanded="true" when an accordion is expanded.
  • Color combinations have sufficient contrast.

Closes #1724 (closed)

Edited by Simon Knox

Merge request reports