Skip to content

Dark mode support#159

Open
alexander-beedie wants to merge 1 commit intonschloe:mainfrom
alexander-beedie:dark-mode-support
Open

Dark mode support#159
alexander-beedie wants to merge 1 commit intonschloe:mainfrom
alexander-beedie:dark-mode-support

Conversation

@alexander-beedie
Copy link
Copy Markdown

@alexander-beedie alexander-beedie commented Mar 17, 2023

Tweaked tuna.css to enable automatic dark mode support.

Colour/theme has not changed at all in regular/light mode, but if dark mode is enabled, tuna will now come along for the ride automatically. If you'd like to modify further, or play with some alternatives, the theme colours have all been extracted into vars, so it should be easy to experiment 👍

:root {
  /* light theme */
  --color-background: #f5f5f5;
  --color-sidebar: #f8f9fa;
  --color-footer: #c6c7c8;
  --color-footer-text: #000000;
  --color-stroke: #ffffff;

  /* rects: material, light blue 50 */
  --color-rect0: #01579b;
  --color-rect0-hover: #0277bd;
  --color-rect1: #0288d1;
  --color-rect1-hover: #0277bd;
  --color-rect2: #0288d1;
  --color-rect2-hover: #0277bd;
  --color-rect3: #bdbdbd;
  --color-rect3-hover: #757575;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* dark theme */
    --color-background: #1a1a1a;
    --color-sidebar: #212121;
    --color-footer: #212121;
    --color-footer-text: #ffffff;
    --color-stroke: #212121;

    /* rects: darker counterparts */
    --color-rect0: #1e3d4c;
    --color-rect0-hover: #285166;
    --color-rect1: #32657f;
    --color-rect1-hover: #285166;
    --color-rect2: #32657f;
    --color-rect2-hover: #285166;
    --color-rect3: #80919c;
    --color-rect3-hover: #6d7f8c;
  }
}

Example

Light mode: (current)

tuna_light_mode

Dark mode: (new)

tuna_dark_mode

Comment thread tuna/web/static/tuna.css
html {
position: relative;
min-height: 100%;
}
Copy link
Copy Markdown
Contributor

@hugovk hugovk Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this!

I noticed for shorter charts, the bottom of the screen is white:

image

Adding this to html fixes it:

Suggested change
background-color: var(--color-background);
}
Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants