@dugyu/luna-tailwind
v0.4.0
Published
TailwindCSS preset for the L.U.N.A project
Downloads
1,296
Maintainers
Readme
luna-tailwind
TailwindCSS preset for the LUNA theming system.
@dugyu/luna-tailwind maps LUNA color tokens to Tailwind color utilities using CSS variables. It is designed to be used together with @dugyu/luna-styles, which provides the actual --* variables under theme class names (e.g. .lunaris-dark, .luna-light).
Installation
pnpm add -D @dugyu/luna-tailwind @lynx-js/tailwind-preset tailwindcss@v3
pnpm add @dugyu/luna-stylesHow It Works
theme.colorsis extended so utilities likebg-primaryresolve tovar(--primary)- Tokens are registered as nested Tailwind color keys and expand into hyphenated utilities —
text-primary-contentresolves tovar(--primary-content) - Variables are scoped by the theme class you apply in your DOM tree, so switching themes is just toggling the theme class name
Setup
Add the preset to your tailwind.config.ts:
import LynxPreset from '@lynx-js/tailwind-preset';
import type { Config } from 'tailwindcss';
import { LunaPreset } from '@dugyu/luna-tailwind';
const config: Config = {
content: [],
presets: [LynxPreset, LunaPreset],
};
export default config;Import LUNA theme variables once (global stylesheet):
@import "@dugyu/luna-styles/index.css";
@tailwind base;
@tailwind components;
@tailwind utilities;Usage
import { Button } from '@lynx-js/lynx-ui';
function App() {
return (
<view className='lunaris-dark'>
<Button className='bg-primary'>
<text className='text-primary-content'>Button</text>
</Button>
</view>
);
}Built-in Gradients
This preset also ships gradient classes that use the LUNA gradient tokens:
luna-gradientluna-gradient-roseluna-gradient-berryluna-gradient-ocean
LUNA Packages
@dugyu/luna-tokens— source of truth for token values@dugyu/luna-core— token and theme type definitions@dugyu/luna-styles— CSS variables output@dugyu/luna-tailwind— Tailwind utilities output (this package)@dugyu/luna-reactlynx— ReactLynx runtime integration
