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

Black table on light theme #3369

Closed
XueSheng-GIT opened this issue Nov 6, 2022 · 8 comments · Fixed by #3733
Closed

Black table on light theme #3369

XueSheng-GIT opened this issue Nov 6, 2022 · 8 comments · Fixed by #3733
Labels
2. developing bug Something isn't working upstream

Comments

@XueSheng-GIT
Copy link

Describe the bug
If light theme is chosen, tables are shown in black.

To Reproduce
Steps to reproduce the behavior:

  1. Choose light theme
  2. Open a markdown (text) file
  3. Create a table

Expected behavior
Table should be "normally" visible (black lines/letters on white ground).

Screenshots
Black table

Client details:

  • OS: Ubuntu 22.04
  • Browser: Firefox
  • Version: 106.0.2
  • Device: Desktop
Server details

Text app version: 3.6.0

Operating system: Ubuntu 20.04

Web server: apache2 (2.4.54)

Database: mariadb (Ver 15.1 Distrib 10.3.34-MariaDB)

PHP version: 7.4.32

Nextcloud version: 25.0.1

@XueSheng-GIT XueSheng-GIT added the bug Something isn't working label Nov 6, 2022
@juliushaertl
Copy link
Member

I cannot reproduce this, can you maybe check if this is some browser caching that still sticky to a dark version? Does it also happen when you try loading in a private browser window?

@XueSheng-GIT
Copy link
Author

Just logged in with a different user on another client (PC) with private browsing (firefox). This time the theme defaulted to light.
Opening the markdown file, the table was shown correctly (white for the light theme). Closing the markdown file, changing the theme to dark and opening the markdown file again result now in the opposite isssue (white table on dark theme).
Markdown Table

This is reproduceable for me and doesn't seem to be related to an old cache on the first view.
@juliushaertl Did you try to change the theme?

@juliushaertl
Copy link
Member

How and where did you change the theme? I tried with the OS native dark/light mode on macOS and the table properly adjusts there.

@XueSheng-GIT
Copy link
Author

I used the personal theme settings. It defaults to "system standard" and was manually changed to either light or dark.

Theme

@XueSheng-GIT
Copy link
Author

Just tried to keep the "system standard" setting of the theme and changed light/dark within the windows settings and the table color changes as expected (don't have access to my Ubuntu PC right now to double check there). Thus it seems to be related to the "manual" light/dark setting within nextcloud.

@juliushaertl
Copy link
Member

Interesting, I can reproduce this, looks like the browser is somehow not picking up the right value for the css variables, even though the original one has the correct color set:

Screenshot 2022-11-07 at 08 58 34

Screenshot 2022-11-07 at 08 58 40

@susnux
Copy link
Contributor

susnux commented Nov 7, 2022

This is not only related to firefox, but I can also reproduce this on chromium when setting the preferred color theme to dark but configuring nextcloud to use the light color theme.

@susnux
Copy link
Contributor

susnux commented Jan 31, 2023

After experiencing this issue also on the forms app, I finally found the reason for this and a fix 🥳

The problem is the css variable evaluation order. So in this case:

  • HTML tag
    • defines --color-main-background for dark color theme (as requested by the browser)
    • defines --table-color-background to be the same as --color-main-background
  • Body tag
    • redefines --color-main-background to match the theme (because data-theme-light is set on the body tag)
  • Table tag
    • Uses --table-color-background which evaluates to HTML-Tag::--color-main-background and in the context it is set to dark instead of bright.

So the solution would be that the server sets data-theme-light on the HTML tag rather than the body tag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2. developing bug Something isn't working upstream
Projects
None yet
3 participants