TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

light-dark()

63 点作者 clairity超过 1 年前

3 条评论

6510超过 1 年前
No offense but how about bothering to finish Alternative Style Sheet selection?<p><pre><code> &lt;link href=&quot;css.css&quot; rel=&quot;stylesheet&quot; title=&quot;Default Style&quot; &#x2F;&gt; &lt;link href=&quot;a.css&quot; rel=&quot;alternate stylesheet&quot; title=&quot;light&quot; &#x2F;&gt; &lt;link href=&quot;b.css&quot; rel=&quot;alternate stylesheet&quot; title=&quot;dark&quot; &#x2F;&gt; </code></pre> Or is this not precisely the same thing?<p><a href="https:&#x2F;&#x2F;html.spec.whatwg.org&#x2F;multipage&#x2F;links.html#rel-alternate" rel="nofollow noreferrer">https:&#x2F;&#x2F;html.spec.whatwg.org&#x2F;multipage&#x2F;links.html#rel-altern...</a><p>edit: with finish I mean use this for light&#x2F;dark mode and fix it so that the preference chosen by the user is not immediately discarded after navigation. One doesn&#x27;t discard user selected preferences. It is not done.
cantSpellSober超过 1 年前
What if, in the future, we have more than two options (light and dark)?<p>@media (prefers-color-scheme: [name]) seems more extensible, but this feels simpler and easier to read.<p>Glad the function accepts custom properties (CSS &quot;variables&quot;).<p>Should probably add a color property that doesn&#x27;t use this function as a fallback for browsers that don&#x27;t support it.
评论 #38483129 未加载
评论 #38486891 未加载
davidkunz超过 1 年前
I think `black` and `white` should be switched here:<p>color: light-dark(black, white);
评论 #38470033 未加载