Skip to content

Commit c07c3bf

Browse files
chore: document theme switch imports (#540)
* chore: add field-sizing to select and textarea * document theme switches * looks great, a few edits * update commit --------- Co-authored-by: Adam Argyle <[email protected]>
1 parent d4b651a commit c07c3bf

File tree

2 files changed

+46
-2
lines changed

2 files changed

+46
-2
lines changed

docsite/index.html

+45-1
Original file line numberDiff line numberDiff line change
@@ -1713,7 +1713,7 @@ <h5>NPM Imported Usage Sample</h5>
17131713
</article>
17141714

17151715
<details>
1716-
<summary>Color Theming 101</summary>
1716+
<summary>Color 101: Themes</summary>
17171717

17181718
<div class="just-for-gap">
17191719
<header>
@@ -1921,6 +1921,50 @@ <h5>Typography</h5>
19211921
</div>
19221922
</div>
19231923
</details>
1924+
1925+
<details>
1926+
<summary>Color 201: Normalize Theme Switch</summary>
1927+
1928+
<div class="just-for-gap">
1929+
<header>
1930+
<h3>1) Normalize Theme Switch</h3>
1931+
<pre class="language-css">
1932+
<code>
1933+
@import "https://unpkg.com/open-props/theme.light.switch.min.css";
1934+
@import "https://unpkg.com/open-props/theme.dark.switch.min.css";
1935+
</code>
1936+
</pre>
1937+
<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>
1938+
1939+
<p><b>Light Selectors:</b> <code>.light</code> | <code></code>.light-theme</code> | <code>data-theme="light"</code></p>
1940+
<p><b>Dark Selectors:</b> <code>.dark</code> | <code>.dark-theme</code> | <code>data-theme="dark"</code></p>
1941+
1942+
<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>
1943+
<p><b>See it in action:</b> <a href="https://codepen.io/argyleink/pen/JjqYdgr">here</a></p>
1944+
</header>
1945+
1946+
<header>
1947+
<h3>2) Section theme</h3>
1948+
<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>
1949+
<p><b>Try it</b> <a href="https://codepen.io/argyleink/pen/RwEWRwR">here</a></p>
1950+
</header>
1951+
1952+
<div>
1953+
<pre class="language-css">
1954+
<code>
1955+
@import "https://unpkg.com/open-props/theme.light.switch.min.css";
1956+
@import "https://unpkg.com/open-props/theme.dark.switch.min.css";
1957+
1958+
/* classes toggle the adaptive props */
1959+
.dark, .light {
1960+
color: var(--text-1);
1961+
background: var(--surface-1);
1962+
}
1963+
</code>
1964+
</pre>
1965+
</div>
1966+
</div>
1967+
</details>
19241968
</section>
19251969

19261970
<section id="gradients" class="just-stretch">

src/extra/normalize.src.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@
138138
border-radius: var(--radius-2);
139139
}
140140

141-
:where(textarea) {
141+
:where(textarea) {
142142
resize: block;
143143
field-sizing: content;
144144
min-inline-size: var(--size-content-1);

0 commit comments

Comments
 (0)