Tea Simple Smart CSS
TSS · v1.0.4 · MIT
Lightweight, zero-config, utility-first CSS engine. Scans HTML at runtime, generates only used CSS, and handles dark mode automatically.
~10kb
Minified
0
Dependencies
Auto
Dark Mode
CDN
Ready
Runtime
Zero-build CSS generation based on your actual HTML usage.
Dark Mode
Tokens adapt automatically to system settings or manual toggle.
Observer
Watches for DOM changes to style dynamic elements instantly.
Utilities
Standard utility names. If you know Tailwind, you know TSS.
Responsive Support
Breakpoints (sm:, md:, lg:) are arriving soon.
Installation
Install via package manager or use the CDN.
CDN
EasiestDrop the script in your <head>.
<!-- jsDelivr (recommended) --> <script src="https://cdn.jsdelivr.net/npm/tea-simple-smart-css@1.0.4/dist/tss.min.js"></script> <!-- or unpkg --> <script src="https://unpkg.com/tea-simple-smart-css@1.0.4/dist/tss.min.js"></script>
npm / bun
npm install tea-simple-smart-cssES Module Import
import TSS from 'tea-simple-smart-css';
Quick Start
Minimal production-ready template.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <script src="https://cdn.jsdelivr.net/npm/tea-simple-smart-css@1.0.4/dist/tss.min.js"></script> </head> <body class="bg-base text-body"> <div class="max-w-xl mx-auto p-8"> <h1 class="text-3xl font-bold text-heading mb-4">Hello TSS</h1> <p class="text-body mb-6">Auto light & dark mode.</p> <div class="bg-accent text-white p-4 rounded-xl"> Styled with TSS utilities </div> <button onclick="TSS.toggleDark()" class="mt-4 bg-muted text-heading px-4 py-2 rounded-lg cursor-pointer border"> Toggle Dark Mode </button> </div> </body> </html>
How It Works
Understanding TSS internals in three steps.
DOM Scan
TSS scans every element and generates required CSS at runtime.
Theming
TSS injects semantic tokens as CSS variables with dark mode support.
--tss-accent: #4f46e5;
}
@media (prefers-color-scheme: dark) {
--tss-accent: #818cf8;
}
Watch Changes
TSS watches for new elements to apply styles automatically.
Class Explorer
Type any TSS class to instantly see the CSS it generates — powered by parse().
Enter a class above to see generated CSS ↑
Quick examples:
Semantic Colors
These tokens automatically switch between light and dark values. Use them with bg-{token}, text-{token}, and border-{token}.
| Token | Light | Dark | Preview | Usage |
|---|---|---|---|---|
primary | #ffffff | #09090b | Card backgrounds | |
secondary | #f3f4f6 | #18181b | Sidebars, panels | |
tertiary | #e5e7eb | #27272a | Nested containers | |
surface | #ffffff | #18181b | Main surface | |
base | #f9fafb | #09090b | Page background | |
muted | #f3f4f6 | #27272a | Subtle sections | |
inverse | #111827 | #f9fafb | Inverted banners | |
heading | #111827 | #f9fafb | Headings, titles | |
body | #374151 | #d1d5db | Paragraph text | |
subtle | #6b7280 | #9ca3af | Captions, hints | |
disabled | #9ca3af | #52525b | Disabled state | |
accent | #4f46e5 | #818cf8 | Primary actions | |
link | #2563eb | #60a5fa | Hyperlinks | |
success | #16a34a | #4ade80 | Success states | |
warning | #f59e0b | #fbbf24 | Warnings | |
danger | #dc2626 | #f87171 | Errors | |
info | #2563eb | #60a5fa | Informational | |
outline | #e5e7eb | #3f3f46 | Border color | |
ring | #3b82f6 | #60a5fa | Focus rings |
Text Color Tokens
text-heading: titles
text-body: paragraph
text-subtle: secondary info
text-disabled: inactive
text-link: interactive
Color Palette
Fixed color shades, identical in both light and dark mode. Syntax: bg-{color}-{shade} or text-{color}-{shade}.
slate
red
orange
amber
green
teal
blue
indigo
violet
pink
Gray · Zinc · Rose · Sky · Cyan · Lime · Yellow · Purple · Emerald
All families support shades: 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950
Typography
Font sizes, weights, alignment and text utilities.
Font Sizes
| Class | Size | Line Height | Preview |
|---|---|---|---|
text-xs | 0.75rem | 1rem | The quick brown fox |
text-sm | 0.875rem | 1.25rem | The quick brown fox |
text-base | 1rem | 1.5rem | The quick brown fox |
text-lg | 1.125rem | 1.75rem | The quick brown fox |
text-xl | 1.25rem | 1.75rem | The quick brown fox |
text-2xl | 1.5rem | 2rem | The quick brown fox |
text-3xl | 1.875rem | 2.25rem | The quick brown fox |
text-4xl | 2.25rem | 2.5rem | The quick brown fox |
text-5xl | 3rem | 1 | TSS |
Font Weights
| Class | Weight | Preview |
|---|---|---|
font-thin | 100 | Tea Simple Smart CSS |
font-extralight | 200 | Tea Simple Smart CSS |
font-light | 300 | Tea Simple Smart CSS |
font-normal | 400 | Tea Simple Smart CSS |
font-medium | 500 | Tea Simple Smart CSS |
font-semibold | 600 | Tea Simple Smart CSS |
font-bold | 700 | Tea Simple Smart CSS |
font-extrabold | 800 | Tea Simple Smart CSS |
font-black | 900 | Tea Simple Smart CSS |
Text Utilities
Alignment
text-left
text-center
text-right
Transform
uppercase
LOWERCASE
capitalize me
Decoration
underline
overline
line-through
Misc
italic
truncate: long text trimmed with ellipsis.
Spacing
Consistent scale for padding and margin. Axis variants supported.
| Key | Value | Pixels |
|---|---|---|
0 | 0 | 0px |
px | 1px | 1px |
0.5 | 0.125rem | 2px |
1 | 0.25rem | 4px |
2 | 0.5rem | 8px |
3 | 0.75rem | 12px |
4 | 1rem | 16px |
5 | 1.25rem | 20px |
6 | 1.5rem | 24px |
8 | 2rem | 32px |
10 | 2.5rem | 40px |
12 | 3rem | 48px |
16 | 4rem | 64px |
20 | 5rem | 80px |
24 | 6rem | 96px |
auto | auto | - |
Padding Visual
Borders & Radius
Border widths, colors, and radius utilities.
Border Width
borderborder-2border-4border-8Border Sides
border-t-4border-r-4border-b-4border-l-4Border Colors
accentsuccessdangerwarningblue-500purple-500Border Radius
nonesmroundedmdlgxl2xlfullLayout & Flexbox
Display and flexbox utilities.
Flex Examples
flex justify-between items-center
flex gap-3
flex flex-col gap-2
| Class | CSS |
|---|---|
flex-row / flex-col | flex-direction: row / column |
flex-wrap / flex-nowrap | flex-wrap: wrap / nowrap |
flex-1 | flex: 1 1 0% |
flex-none | flex: none |
flex-grow / flex-shrink-0 | flex-grow: 1 / flex-shrink: 0 |
items-start/center/end/stretch | align-items: … |
justify-start/center/end/between/around/evenly | justify-content: … |
self-start/center/end/stretch | align-self: … |
gap-{n} / gap-x-{n} / gap-y-{n} | gap / column-gap / row-gap: … |
Grid
CSS Grid utilities for two-dimensional layouts.
grid grid-cols-3 gap-3
grid-cols-4 with col-span-2 and col-span-full
| Class | CSS |
|---|---|
grid-cols-{1-12} | grid-template-columns: repeat(n, minmax(0, 1fr)) |
grid-rows-{1-6} | grid-template-rows: repeat(n, minmax(0, 1fr)) |
col-span-{n} | grid-column: span n / span n |
col-span-full | grid-column: 1 / -1 |
row-span-{n} | grid-row: span n / span n |
place-items-center | place-items: center |
place-content-center | place-content: center |
Sizing
Width, height, and min/max sizing utilities.
| Prefix | Property | Examples |
|---|---|---|
w-{n} | width | w-4, w-8, w-16, w-full, w-auto |
h-{n} | height | h-4, h-8, h-screen, h-full |
w-{a}/{b} | width % | w-1/2 (50%), w-1/3 (33%), w-3/4 (75%) |
size-{n} | width + height | size-8 → w-8 h-8 |
max-w-{key} | max-width | max-w-sm, max-w-xl, max-w-7xl |
min-w-{n} | min-width | min-w-0, min-w-full |
min-h-{n} | min-height | min-h-0, min-h-screen |
max-h-{n} | max-height | max-h-96, max-h-screen |
max-w Scale
| Class | Value |
|---|---|
max-w-xs | 20rem (320px) |
max-w-sm | 24rem (384px) |
max-w-md | 28rem (448px) |
max-w-lg | 32rem (512px) |
max-w-xl | 36rem (576px) |
max-w-2xl | 42rem (672px) |
max-w-3xl | 48rem (768px) |
max-w-4xl | 56rem (896px) |
max-w-5xl | 64rem (1024px) |
max-w-6xl | 72rem (1152px) |
max-w-7xl | 80rem (1280px) |
Positioning
Position utilities and inset helpers.
| Class | CSS |
|---|---|
static / relative / absolute / fixed / sticky | position: … |
top-{n} / right-{n} / bottom-{n} / left-{n} | top / right / bottom / left: … |
inset-{n} | top + right + bottom + left: … |
inset-x-{n} | left + right: … |
inset-y-{n} | top + bottom: … |
z-{0|10|20|30|40|50|auto} | z-index: … |
Shadows
Box shadow utilities from subtle to dramatic.
shadow-smshadowshadow-mdshadow-lgshadow-xlshadow-2xlTransitions
Smooth state changes with zero boilerplate.
| Class | Properties Transitioned |
|---|---|
transition | color, bg, border, opacity, shadow, transform — 150ms ease |
transition-all | all — 150ms ease |
transition-colors | color, background-color, border-color — 150ms ease |
transition-opacity | opacity — 150ms ease |
transition-shadow | box-shadow — 150ms ease |
transition-transform | transform — 150ms ease |
transition-none | none (disabled) |
Easing
| Class | Cubic Bezier |
|---|---|
ease-linear | linear |
ease-in | cubic-bezier(0.4, 0, 1, 1) |
ease-out | cubic-bezier(0, 0, 0.2, 1) |
ease-in-out | cubic-bezier(0.4, 0, 0.2, 1) |
Effects & Shimmer
Premium animations for skeleton loaders and state indicators.
Pulse vs Shimmer
animate-pulsebg-shimmerUsage Example
Utilities
Miscellaneous utility classes for common CSS patterns.
Opacity
opacity-0 | 0 |
opacity-25 | 0.25 |
opacity-50 | 0.5 |
opacity-75 | 0.75 |
opacity-100 | 1 |
Overflow
overflow-hidden | hidden |
overflow-auto | auto |
overflow-scroll | scroll |
overflow-visible | visible |
overflow-x-hidden | x: hidden |
overflow-y-auto | y: auto |
Cursor
cursor-pointer | pointer |
cursor-default | default |
cursor-not-allowed | not-allowed |
cursor-wait | wait |
cursor-grab | grab |
cursor-none | none |
Misc
truncate | overflow: hidden + ellipsis |
outline-none | outline: 2px solid transparent |
italic | font-style: italic |
antialiased | -webkit-font-smoothing: antialiased |
pointer-events-none | pointer-events: none |
sr-only | Visually hidden, screen-reader accessible |
State Modifiers
Interactive states like hover can be applied using the hover: prefix.
Hover card example
class="bg-accent hover:bg-indigo-700 transition"API Reference
TSS exposes a small JavaScript API on the global TSS object.
TSS.toggleDark()Toggles dark mode on the <html> element by adding/removing the dark class. Persists preference to localStorage.
Returns
boolean - true if dark mode is now active, false if light.
// Toggle dark mode const isDark = TSS.toggleDark(); console.log(isDark); // true or false
TSS.parse(className)Parses a single TSS class name and returns its selector and CSS rules.
Returns
{ selector: string, rules: Record<string, string> } | null
TSS.parse('bg-accent'); // → { selector: ".bg-accent", rules: { "background-color": "var(--tss-accent)" } } TSS.parse('unknown-class'); // → null
TSS.refresh()Re-scans document.body for TSS classes. Useful after manually injecting HTML that bypasses the MutationObserver.
TSS.refresh(); // re-scan and apply styles
TSS.versionThe current version string of the loaded TSS library.
console.log(TSS.version); // → "1.0.3"