0.0.7 • Published 2 years ago

astro-theme v0.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

🚀 Astro theme utilities

📘 Documentation →

🧑‍🚀 Astro website →

This component should includes various utilities for helping handle theming with astro.

You can find a live usage at astros.warps.it.

Utilities included in the package

NameDescription
ThemeSwitcherSwitch between choosen themes

ThemeSwitcher

Note: Work in progress. for now specifiy only dark, light and dimmed theme names (check below).

How To Use

In any of your Astro pages, import the utility you need:

---
...
/* Import the components you need */
import { ThemeSwitcher } from "astro-theme";
---

<html lang="en">
	<head>
	</head>
	<head>
		<body>
			<header>
				<ThemeSwitcher />
			</header>
		</body>
	</head>
</html>

Now in your global css/scss use css variables like so:

:root {
	--color-bg: white;
	--color-text-primary: black;

	&[data-theme="dark"] {
		--color-bg: black;
		--color-text-primary: white;
	}

	&[data-theme="dimmed"] {
		--color-bg: gray;
		--color-text-primary: white;
	}

	&[data-theme="any-other-theme-you-want"] {
		--color-bg: gray;
		--color-text-primary: white;
	}
}

Supported Props

PropnameTypeDefaultRequiredDescription
themestheme[][{ name: "dark", icon: "ph:moon-thin" },{ name: "light", icon: "ph:sun-thin" }]Themes name and icons to use, objects with name and icon
defaultDarkstringnullName of the theme to use as default for dark (will check prefers-color-scheme)
defaultLightstringnullName of the theme to use as default for light (will check prefers-color-scheme)
typestringrotateType of switcher, for now only rotate is supported
0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago