hplush / slowreader

Web app to combine feeds from social networks and RSS and to help read more meaningful and deep content
https://dev.slowreader.app
GNU Affero General Public License v3.0
160 stars 37 forks source link

Add `theme-color` #75

Closed ai closed 7 months ago

ai commented 11 months ago

We need a user with Chrome for Android to add this feature and test it.

privorotskii commented 7 months ago

I want to take it

privorotskii commented 7 months ago

Hey @ai, I did some context gathering on that, can we discuss it a bit?

Do I get it right that the ultimate goal is to get the Safari's top bar color aligned to the theme color?

Here's a bit of context:

So to summarize: if the ultimate goal is to have the top bar color the same as the background, it's applied by Safari itself by default.

However, we may still want to add this tag for the sake of making it explicit and to add it for Chrome Android and Samsung Internet, but at the moment I don't see a good way to do it without hardcoding the colours. --land-color is a CSS custom property, so it should be something like this

  <meta name="theme-color" content="var(--land-color)" />

But the var as a value is ignored by Safari, so it won't be applied

Safari Compact mode: Light mode Dark mode
Image Image
Safari separate mode: Light mode Dark mode
Image Image
Safari in reading mode: Light mode Dark mode
Image ![Image]Image

Something like this

<meta name="theme-color" media="(prefers-color-scheme: light)" content="light-value-here" />
<meta name="theme-color" media="(prefers-color-scheme: dark)" content="dark-value-here" />
ai commented 7 months ago

Do I get it right that the ultimate goal is to get the Safari's top bar color aligned to the theme color?

Yes

So to summarize: if the ultimate goal is to have the top bar color the same as the background, it's applied by Safari itself by default.

OK. Let’s add it only for Chrome for Android (still a big use base). But even Chrome for Android use theme-color not every time but only in light theme (we may still want to support dark theme for the future).

Do you have Android and Chrome (or some emulator, which you can trust) for this task?

ai commented 7 months ago

I don't see a good way to do it without hardcoding the colours.

We can set theme-color meta tag in JS. In JS we can read manually document.body computed colors or try to find some API to get CSS Custom Property value.

ai commented 7 months ago

Also, thanks for doing a greet deep research. I like it 🔥

privorotskii commented 7 months ago

OK. Let’s add it only for Chrome for Android (still a big use base). But even Chrome for Android use theme-color not every time but only in light theme (we may still want to support dark theme for the future).

Okay, makes sense, thanks for the clarification

Do you have Android and Chrome (or some emulator, which you can trust) for this task?

Not as an Android device, but I think I'll be able to use Android Studio emulator for the testing purposes, should be good enough

We can set theme-color meta tag in JS. In JS we can read manually document.body computed colors or try to find some API to get CSS Custom Property value.

Makes sense too, will look into it, thanks 👀