Telefonica / mistica-design

Mística Design System (only design)
https://brandfactory.telefonica.com/mistica
20 stars 4 forks source link

Multilayers in dark mode (elevations) #1765

Open yceballost opened 1 month ago

yceballost commented 1 month ago

Description

OverMedia context (#1764) can resolve elevation problems in dark mode.

BackgroundContainer should set a color with opacity to make possible different elevation when you include a boxed component inside other boxed component.

This opacity in backgroundContainer will be a problem when you use a boxed over image or floating elements (sidebar, fixed elements in the screen, etc). To fix this problem we need to create new tokens that will be used with OverMedia context

Tasks

aweell commented 1 month ago

There are three categories here:

  1. Elements that are directly positioned over a media element: They should have a solid color
  2. Elements that are positioned over another container or background: The should have a transparent color
  3. Elements that are fixed, relative or absolute positioned: They should have a solid color

The solution proposed:

Elements that have to use backgroundContainerSolid always:

Elements that should have transparent background in dark:

aweell commented 1 month ago

There were two initial approaches for this task:

  1. Generate layers with alpha
  2. Determine when specific elements are contained within others to change their background

I propose a third approach: using borders, similar to light mode, on elements that can potentially be placed inside a boxed element.

The reason for this proposal is that, for example, with interactive elements like text fields, even using an alpha for the background, we cannot ensure a 3:1 contrast ratio with the card background. Adding a border would make this simpler.