Closed privorotskii closed 7 months ago
Hey @ai, I think I'm a bit stuck here Here's what I tried and why it didn't work out:
#idea
Just use the var(--land-color)
as a tag content
#issue
Neither Safari nor Chrome support var as a content. #idea
Use two tags, one for dark theme, one for light theme
#note
We can do that using the media attribute, e.g. <meta name="theme-color" media="(prefers-color-scheme: light)" content="..." />
#issue
We have not only dark or light themes, we also have different pages — slow and fast which have different --land-color property we'd like to use#idea
Use JS to get the computed value of the --land-color
#issue
The --land-color
has value using color-mix
function which isn't supported by this tagSo what I did in order to get the working version is taking the actual background colors via colorPicker and converting them to oklch. I added those values as new CSS properties, but it doesn't feel like a good way to handle it:
color-mix
for the --land-color
since it's actually the same color, but in different notation which is harder to edit--land-color
is updated, which is not obvious and could be missed at some point--land-color
, some discrepancies in the convertation process could ariseDoes it make sense to do it this way or it's better to wait for better support from browsers? Or are there any better ideas? I'm open to any discussions and suggestions
Good research 👍. I suggested a way to avoid browsers limits.
Next time, don’t forget to run pnpm test
before creating PR.
@ai I did, it passes for me on this branch. Was something wrong after merging? Asking in case it behaves differently on different machines or not
Size Limit was wrong.
https://github.com/hplush/slowreader/actions/runs/8507486659
Maybe after rebasing on new main
branch.
Fixes issue
theme-color
tag--land-color
CSS propertyMotivation
note
Chrome on Android supports it only within light themenote
Safari also supports this tag, but it colors top bar without this tag by itselfScreenshot or video
Chrome Android:
Safari (no changes):
Checklist
scripts/
, add a comment with a description.README.md
.README.md
.core/
. What code will also be useful on other platforms?pnpm size
and check the difference in the JS bundle size. Is it relevant to the changes? Change the limit inweb/.size-limit.json
if necessary.index.html
.core/
: