# EVA CSS - Full Documentation > A fluid SCSS framework that converts static UI designs into responsive systems using CSS clamp() and OKLCH colors. Version: 2.0.5 Website: https://eva-css.xyz GitHub: https://github.com/nkdeus/eva npm packages: eva-css-fluid, eva-css-purge, eva-colors --- ## Installation ```bash npm install eva-css-fluid eva-css-purge eva-colors ``` ## Configuration Single workflow: SCSS-only. Configure inline via `@use ... with (...)`. ```scss @use 'eva-css-fluid' with ( $sizes: (4, 8, 16, 32, 64, 128), $font-sizes: (14, 16, 20, 24, 32), $build-class: true, $px-rem-suffix: false, $name-by-size: true, $custom-class: false ); ``` Build: `npx sass --load-path=node_modules styles/main.scss:styles/main.css` ### Configuration variables | Variable | Effect | |----------|--------| | `$sizes` | List of px sizes → fluid `var(--SIZE)` | | `$font-sizes` | List of font sizes → fluid `var(--FONT-SIZE)` | | `$build-class` | `true`: utility classes, `false`: variables only | | `$px-rem-suffix` | Add px/rem static utilities (debug-friendly) | | `$name-by-size` | `true`: `--32`, `false`: sequential `--3` | | `$custom-class` | Filter generated classes | --- ## Fluid Scaling System EVA CSS replaces breakpoints with `clamp()` functions. Every size scales fluidly between a minimum (mobile) and maximum (desktop) viewport. ### Size Variables Given `$sizes: (4, 8, 16, 32, 64, 128)`, EVA generates: | Variable | Meaning | |----------|---------| | `var(--16)` | Standard fluid scaling for 16px | | `var(--16_)` | Reduced scaling (less variation) | | `var(--16__)` | Extreme reduction (near-static) | | `var(--16-)` | Extended scaling (more variation) | ### Font Size Variables Given `$font-sizes: (14, 16, 20, 24, 32)`, EVA generates: | Variable | Meaning | |----------|---------| | `var(--24)` | Standard fluid font size | | `var(--24_)` | Reduced fluid font size | | `var(--24__)` | Extreme reduction | ### Two Build Modes **Utility Classes (`buildClass: true`):** Generates classes like `w-64`, `h-32`, `p-16`, `g-8`, `fs-24`, `_bg-brand`, `_c-dark`. Use directly in HTML. **Variables Only (`buildClass: false`):** Only generates CSS custom properties. Write semantic CSS: ```scss .hero { padding: var(--64); font-size: var(--32); color: var(--brand); } ``` --- ## Color System (OKLCH) EVA CSS uses the OKLCH color space for perceptually uniform colors. ### Base Colors Define 5 base colors: `brand`, `accent`, `extra`, `dark`, `light`. Colors can be specified as HEX (auto-converted) or OKLCH: ```javascript colors: { brand: '#ff5733', // HEX format dark: { lightness: 20, chroma: 0.05, hue: 200 } // OKLCH format } ``` ### Color Variables | Variable | Description | |----------|-------------| | `var(--brand)` | Base brand color | | `var(--brand_)` | 65% opacity | | `var(--brand__)` | 35% opacity | | `var(--brand___)` | 5% opacity | | `var(--brand-d)` | Darker variant | | `var(--brand-b)` | Brighter variant | | `var(--brand-d_)` | More darker | | `var(--brand-b_)` | More brighter | Same pattern for `accent`, `extra`, `dark`, `light`. ### Theme Configuration Themes are CSS classes applied to the body: ```html
``` Theme class defines OKLCH values: ```scss .theme-myproject { --brand-lightness: 62.8%; --brand-chroma: 0.258; --brand-hue: 29.23; --accent-lightness: 55%; --accent-chroma: 0.3; --accent-hue: 290; // ... etc for extra, dark, light } ``` ### Light/Dark Mode Toggle is controlled via the `.toggle-theme` class on `body`. Use `.current-theme` + `.theme-NAME` together. Auto-switch can be wired via JS or CSS `@media (prefers-color-scheme)`. ### Color Utilities (eva-colors CLI) ```bash npx eva-color convert "#ff0000" # HEX to OKLCH npx eva-color palette "#ff0000" 7 # Generate 7-step palette npx eva-color theme config.json # Generate theme from JSON npx eva-color contrast "#fff" "#000" # WCAG contrast check ``` --- ## Gradient System EVA CSS includes Emmet-style gradient classes. ### Core Classes | Class | Effect | |-------|--------| | `grad-linear` | Linear gradient background | | `grad-radial` | Radial gradient from center | | `grad-linear-text` | Gradient applied to text | | `grad-radial-text` | Radial gradient on text | | `grad-linear-border` | Gradient border | | `grad-radial-border` | Radial gradient border | ### Color Control | Class | Sets | |-------|------| | `from-brand` | Start color = brand | | `to-accent` | End color = accent | | `from-brand_` | Start = brand at 65% opacity | | `to-extra-d` | End = extra darker variant | | `from-transparent` | Transparent start | ### Direction | Class | Direction | |-------|-----------| | `d-t` | To top | | `d-b` | To bottom | | `d-l` | To left | | `d-r` | To right | | `d-tl` | To top left | | `d-tr` | To top right | | `d-bl` | To bottom left | | `d-br` | To bottom right | ### Angle `a-0` through `a-360` in 5-degree increments: `a-45`, `a-90`, `a-135`, `a-180`, etc. ### Animation | Class | Duration | |-------|----------| | `animated` | 3s | | `animated-slow` | 6s | | `animated-fast` | 1s | ### Background Size | Class | Size | |-------|------| | `bg-size` | 150% | | `bg-size_` | 200% | | `bg-size__` | 300% | ### Example ```html