mirror of
https://github.com/jenil/chota.git
synced 2023-08-10 21:13:07 +03:00
initial dark-mode config
This commit is contained in:
parent
2806b45f69
commit
8eae720abc
@ -1,3 +1,10 @@
|
|||||||
|
body.dark {
|
||||||
|
--body-bg-color: #000;
|
||||||
|
--font-color: #f5f5f5;
|
||||||
|
--color-grey: #ccc;
|
||||||
|
--color-darkGrey: #aaa;
|
||||||
|
}
|
||||||
|
|
||||||
body>.container {
|
body>.container {
|
||||||
max-width: 720px;
|
max-width: 720px;
|
||||||
}
|
}
|
||||||
@ -26,6 +33,10 @@ body>footer {
|
|||||||
padding: 4rem;
|
padding: 4rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
body.dark>footer {
|
||||||
|
background-color: #1a1a1a;
|
||||||
|
}
|
||||||
|
|
||||||
section {
|
section {
|
||||||
margin: 5rem auto;
|
margin: 5rem auto;
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
<title>chota - A micro CSS framework</title>
|
<title>chota - A micro CSS framework</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<link rel="stylesheet" href="https://unpkg.com/chota">
|
<link rel="stylesheet" href="https://unpkg.com/chota">
|
||||||
|
<!-- <link rel="stylesheet" href="./dist/chota.css"> -->
|
||||||
<link rel="stylesheet" href="./doc-styles.css">
|
<link rel="stylesheet" href="./doc-styles.css">
|
||||||
<link rel="icon" type="image/png" href="favicon.png" />
|
<link rel="icon" type="image/png" href="favicon.png" />
|
||||||
</head>
|
</head>
|
||||||
@ -26,6 +27,15 @@
|
|||||||
<a href="#start">start</a>
|
<a href="#start">start</a>
|
||||||
<a href="#docs">docs</a>
|
<a href="#docs">docs</a>
|
||||||
<a href="https://github.com/jenil/chota">GitHub</a>
|
<a href="https://github.com/jenil/chota">GitHub</a>
|
||||||
|
<a
|
||||||
|
href="javascript:void(0)"
|
||||||
|
onclick="
|
||||||
|
const bodyClass = document.body.classList;
|
||||||
|
bodyClass.contains('dark')
|
||||||
|
? (this.innerHTML = '☀️', bodyClass.remove('dark'))
|
||||||
|
: (this.innerHTML = '🌙', bodyClass.add('dark'));
|
||||||
|
"
|
||||||
|
>☀️</a>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -38,6 +48,7 @@
|
|||||||
<li>🌈 Easy to <a href="#customizing">extend</a> with CSS variables</li>
|
<li>🌈 Easy to <a href="#customizing">extend</a> with CSS variables</li>
|
||||||
<li>🎲 Comes with a handful of <a href="#components">components</a> & <a href="#utilities">utilities</a></li>
|
<li>🎲 Comes with a handful of <a href="#components">components</a> & <a href="#utilities">utilities</a></li>
|
||||||
<li>✅ Good Semantics</li>
|
<li>✅ Good Semantics</li>
|
||||||
|
<li>🌙 Easy Dark Mode switch</li>
|
||||||
<li>🤡 Supports <a href="#icons">icons</a> out-of-the-box</li>
|
<li>🤡 Supports <a href="#icons">icons</a> out-of-the-box</li>
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
@ -107,6 +118,24 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Other styles..... */
|
/* Other styles..... */
|
||||||
|
{% endhighlight %}
|
||||||
|
<br>
|
||||||
|
<p>Addtionally, you can add dark mode to you site, to support devices that prefer dark mode.</p>
|
||||||
|
{% highlight html %}
|
||||||
|
<style>
|
||||||
|
body.dark {
|
||||||
|
--body-bg-color: #000;
|
||||||
|
--font-color: #f5f5f5;
|
||||||
|
--color-grey: #ccc;
|
||||||
|
--color-darkGrey: #aaa;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<script>
|
||||||
|
if (window.matchMedia &&
|
||||||
|
window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
||||||
|
document.body.classList.add('dark');
|
||||||
|
}
|
||||||
|
</script>
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
</section>
|
</section>
|
||||||
<section id="components">
|
<section id="components">
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
:root {
|
:root {
|
||||||
|
--body-bg-color: #ffffff;
|
||||||
--color-primary: #14854F;
|
--color-primary: #14854F;
|
||||||
--color-lightGrey: #d2d6dd;
|
--color-lightGrey: #d2d6dd;
|
||||||
--color-grey: #747681;
|
--color-grey: #747681;
|
||||||
@ -8,6 +9,7 @@
|
|||||||
--grid-maxWidth: 120rem;
|
--grid-maxWidth: 120rem;
|
||||||
--grid-gutter: 2rem;
|
--grid-gutter: 2rem;
|
||||||
--font-size: 1.6rem;
|
--font-size: 1.6rem;
|
||||||
|
--font-color: #333333;
|
||||||
--font-family-sans: -apple-system, BlinkMacSystemFont, Avenir, "Avenir Next",
|
--font-family-sans: -apple-system, BlinkMacSystemFont, Avenir, "Avenir Next",
|
||||||
"Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans",
|
"Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans",
|
||||||
"Droid Sans", "Helvetica Neue", sans-serif;
|
"Droid Sans", "Helvetica Neue", sans-serif;
|
||||||
@ -27,8 +29,10 @@ html {
|
|||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
|
background-color: var(--body-bg-color);
|
||||||
line-height: 1.6;
|
line-height: 1.6;
|
||||||
font-size: var(--font-size);
|
font-size: var(--font-size);
|
||||||
|
color: var(--font-color);
|
||||||
font-family: "Segoe UI", "Helvetica Neue", sans-serif; /*fallback*/
|
font-family: "Segoe UI", "Helvetica Neue", sans-serif; /*fallback*/
|
||||||
font-family: var(--font-family-sans);
|
font-family: var(--font-family-sans);
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
.card {
|
.card {
|
||||||
padding: 1rem 2rem;
|
padding: 1rem 2rem;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
background: white;
|
background: var(--body-bg-color);
|
||||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
|
box-shadow: 0 1px 3px var(--color-grey);
|
||||||
}
|
}
|
||||||
|
|
||||||
.card p:last-child {
|
.card p:last-child {
|
||||||
|
Loading…
Reference in New Issue
Block a user