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

chore: document theme switch imports #540

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 45 additions & 1 deletion docsite/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1713,7 +1713,7 @@ <h5>NPM Imported Usage Sample</h5>
</article>

<details>
<summary>Color Theming 101</summary>
<summary>Color 101: Themes</summary>

<div class="just-for-gap">
<header>
Expand Down Expand Up @@ -1921,6 +1921,50 @@ <h5>Typography</h5>
</div>
</div>
</details>

<details>
<summary>Color 201: Normalize Theme Switch</summary>

<div class="just-for-gap">
<header>
<h3>1) Normalize Theme Switch</h3>
<pre class="language-css">
<code>
@import "https://unpkg.com/open-props/theme.light.switch.min.css";
@import "https://unpkg.com/open-props/theme.dark.switch.min.css";
</code>
</pre>
<p>The Open Props <a href="https://codepen.io/argyleink/pen/KKvRORE">normalize.css</a> has light and dark built in, but it only changes with the media query / operating system. If you want users to be able to change this, you'll need <b>Open Props switch imports</b>. These have the same theme values from normalize, but scoped to selectors.</p>

<p><b>Light Selectors:</b> <code>.light</code> | <code></code>.light-theme</code> | <code>data-theme="light"</code></p>
<p><b>Dark Selectors:</b> <code>.dark</code> | <code>.dark-theme</code> | <code>data-theme="dark"</code></p>

<p>This allows you to apply a light or dark theme to the page or a portion of the page using the selectors imported.</p>
<p><b>See it in action:</b> <a href="https://codepen.io/argyleink/pen/JjqYdgr">here</a></p>
</header>

<header>
<h3>2) Section theme</h3>
<p>When you need to control the appearance of a specific section, use any of the selectors from the switch imports, like <code>.dark</code> or <code>.light</code>, and apply them to HTML elements.</p>
<p><b>Try it</b> <a href="https://codepen.io/argyleink/pen/RwEWRwR">here</a></p>
</header>

<div>
<pre class="language-css">
<code>
@import "https://unpkg.com/open-props/theme.light.switch.min.css";
@import "https://unpkg.com/open-props/theme.dark.switch.min.css";

/* classes toggle the adaptive props */
.dark, .light {
color: var(--text-1);
background: var(--surface-1);
}
</code>
</pre>
</div>
</div>
</details>
</section>

<section id="gradients" class="just-stretch">
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/extra/normalize.src.css
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
border-radius: var(--radius-2);
}

:where(textarea) {
:where(textarea) {
argyleink marked this conversation as resolved.
Show resolved Hide resolved
resize: block;
field-sizing: content;
min-inline-size: var(--size-content-1);
Expand Down
Loading