@freedomcore/design-system
v0.2.1
Published
Core design system, global styles, and theme switching component
Maintainers
Readme
@freedomcore/design-system
Core design system, global styles, and theme switching component for FreedomCore.
Installation
npm install @freedomcore/design-systemUsage
<link rel="stylesheet" href="node_modules/@freedomcore/design-system/theme-switcher-fc.css">
<!-- Core FC styles (bundled) -->
<link rel="stylesheet" href="node_modules/@freedomcore/design-system/styles/base.css">
<link rel="stylesheet" href="node_modules/@freedomcore/design-system/styles/theme-core.css">
<!-- Place theme stylesheets with data-theme attribute -->
<link rel="stylesheet" href="node_modules/@freedomcore/design-system/styles/theme-purple.css" data-theme>
<theme-switcher-fc></theme-switcher-fc>
<script type="module">
import '@freedomcore/design-system';
</script>Attributes
| Attribute | Description |
|-----------|-------------|
| themes | Comma-separated theme names (auto-detected from CSS if omitted) |
| default | Default theme name |
Bundled Styles
This package includes the core FreedomCore design system:
@freedomcore/design-system/styles/base.css(Reset + Typography)@freedomcore/design-system/styles/colors.css(Color palette)@freedomcore/design-system/styles/tokens.css(Design tokens)@freedomcore/design-system/styles/theme-*.css(Theme presets)
How It Works
- Scans for
<link>elements withdata-themeattribute - Extracts theme names from filenames (e.g.,
theme-purple.css→ "purple") - Swaps the active theme stylesheet on selection
- Persists selection to localStorage
Events
switcher.addEventListener('theme-change', (e) => {
console.log('Theme:', e.detail.theme);
});License
MIT © FreedomCore
