π FSCSS Functions β Make Your CSS Smarter, Faster & Dynamic
What Are FSCSS Functions?
FSCSS (Figured Shorthand CSS) extends normal CSS with powerful function-like abilities. You can reuse values, run calculations, generate random styles, and create dynamic layouts.
1. @fun β Reusable Value Collections
Create grouped reusable values, perfect for themes or design tokens.
@fun(theme){
primary: #3b82f6;
danger: #ef4444;
}
.btn {
background: @fun.theme.primary.value;
}
- @random β Dynamic Variations
Generate different styles per compile β for creative and fun UI effects.
@arr(colors[#3b82f6, #8b5cf6, #10b981]);
.box {
background: @random([@arr.colors(,)]);
}
- num() β Run Math Directly in CSS
Calculate values without switching to JavaScript.
$base: 16;
title {
font-size: num($base! * 1.5)px;
}
- Utility Functions
copy()
color: copy(4, primary-color);
length()
width: num(length("Hello") * 10)px;
count()
@arr(nums[count(5)]); // [1,2,3,4,5]
Why Developers Love FSCSS functions
Β· Reusable design systems
Β· Fewer repeated styles
Β· Dynamic & logic-driven CSS
Β· Cleaner, more expressive syntax
FSCSS Functions level up your CSS workflow by adding logic and dynamic power. Once you start using them, traditional CSS will feel limited.
Full guide @ https://fscss.devtem.org
Top comments (0)