Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a dark mode to table reports #1165

Open
rouk1 opened this issue Nov 29, 2024 · 1 comment
Open

Add a dark mode to table reports #1165

rouk1 opened this issue Nov 29, 2024 · 1 comment
Labels
enhancement New feature or request TableReport anything related to the TableReport

Comments

@rouk1
Copy link
Contributor

rouk1 commented Nov 29, 2024

Problem Description

Table report only has a light theme.

Feature Description

The implementation could be in three parts:

  • extract all colors to css variables
  • use the created variables everywhere
  • create a new set of variables (a dark theme), for a first round dark mode could be current color with inverted luminance
  • use a media query to switch between variables sets

Implementation could look like:

@media (prefers-color-scheme: dark) {
  :host {
    /* backgrounds */
    --color-background-primary: #1a1a1a;
    --color-background-secondary: #222;
    --color-background-plots: #121212;

    /* text */
    --color-text-primary: #fff;
    --color-text-secondary: #a2a2a2;

    /* shadow */
    --color-shadow: rgb(0 0 0/58%);
  }
}

@media (prefers-color-scheme: light) {
  :host {
    /* backgrounds */
    --color-background-primary: #fff;
    --color-background-secondary: #fafafb;
    --color-background-plots: #fdfdfd;

    /* text */
    --color-text-primary: #2f3037;
    --color-text-secondary: #616271;

    /* shadow */
    --color-shadow: rgb(0 0 0/19%);
  }
}

Note

Naming css variables is always tricky, my proposal is to use a consistent pattern: --what-where-variation-interactivity
what could be colors for now but may scale to sizes
where defines in which css rules the variable should be used (background for background, text for font color, ...)
variation values may be variable according to context a title may not have exactly the same color as a subtitle for example
interactivity value on hover for example

Alternative Solutions

No response

Additional Context

No response

@rouk1 rouk1 added the enhancement New feature or request label Nov 29, 2024
@jeromedockes
Copy link
Member

Thanks a lot for opening this @rouk1 ! Your plan sounds great. I'm looking forward to having someone who knows what they are doing (as opposed to me 😅 ) improve the display part of the reports :)

after the dark mode was mentioned in the skore issue I had started a branch (which was not ready for a PR yet) so just in case there's some information in that I opened #1166

for a first round dark mode could be current color with inverted luminance

that sounds good, though note not much thought has gone into the current colors so once everything is organized with a reasonable set of variables we can also redefine all colors for both modes.

Naming css variables is always tricky, my proposal is to use a consistent pattern: --what-where-variation-interactivity

Indeed that part is rather chaotic in the tablereport ATM...

@jeromedockes jeromedockes added the TableReport anything related to the TableReport label Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request TableReport anything related to the TableReport
Projects
None yet
Development

No branches or pull requests

2 participants