Background Color Properties
Introduction
Background color properties are common properties in the Cosy UI component library, used to set the background color of components. Supports basic background colors, opacity variants, and gradient colors.
Basic Background Colors
Theme Colors
primary- Primary colorsecondary- Secondary coloraccent- Accent colorneutral- Neutral color
primary
secondary
accent
neutral
Base Colors
base-100- Base background color (light)base-200- Base background color (medium)base-300- Base background color (dark)
base-100
base-200
base-300
Status Colors
success- Success colorwarning- Warning colorerror- Error colorinfo- Info color
success
warning
error
info
Special Values
transparent- Transparent backgroundnone- No background
transparent
none
Opacity Variants
Each basic background color supports opacity variants in the format color/opacity:
Opacity Values
10- 10% opacity20- 20% opacity30- 30% opacity40- 40% opacity50- 50% opacity60- 60% opacity70- 70% opacity80- 80% opacity90- 90% opacity
Examples
primary/20- Primary color with 20% opacitysuccess/10- Success color with 10% opacityerror/30- Error color with 30% opacity
primary/10
primary/20
primary/30
primary/50
Gradient Colors
Basic Gradients
gradient- Default gradient (primary to secondary)gradient-primary- Primary color gradientgradient-secondary- Secondary color gradientgradient-accent- Accent color gradient
gradient
gradient-primary
gradient-secondary
gradient-accent
Status Gradients
gradient-success- Success color gradientgradient-warning- Warning color gradientgradient-info- Info color gradient
gradient-success
gradient-warning
gradient-info
Theme Gradients
gradient-sky- Sky gradientgradient-sunset- Sunset gradientgradient-forest- Forest gradientgradient-ocean- Ocean gradientgradient-mountain- Mountain gradient
gradient-sky
gradient-sunset
gradient-forest
gradient-ocean
gradient-mountain
Fruit Gradients
gradient-flower- Flower gradientgradient-watermelon- Watermelon gradientgradient-lemon- Lemon gradientgradient-grape- Grape gradientgradient-blueberry- Blueberry gradientgradient-mango- Mango gradientgradient-kiwi- Kiwi gradientgradient-pitaya- Pitaya gradientgradient-banana- Banana gradient
gradient-flower
gradient-watermelon
gradient-lemon
gradient-grape
gradient-blueberry
gradient-mango
Pattern Backgrounds
Basic Patterns
dot-grid- Subtle dot gridstripes- Diagonal stripesgradient-glow- Glow gradient
Modern Background Styles
glassmorphism- Glassmorphism effect (frosted glass)glassmorphism-strong- Strong glassmorphism effectglassmorphism-soft- Soft glassmorphism effectmesh-gradient- Mesh gradient (multiple radial gradients overlay)noise- Noise texturenoise-strong- Strong noise texturenoise-soft- Soft noise textureanimated-gradient- Animated gradient (flowing effect)animated-gradient-fast- Fast animated gradientanimated-gradient-slow- Slow animated gradient
dot-grid
background="dot-grid"
stripes
background="stripes"
gradient-glow
background="gradient-glow"
glassmorphism
background="glassmorphism"
mesh-gradient
background="mesh-gradient"
noise
background="noise"
animated-gradient
background="animated-gradient"
Example:
<Container background="dot-grid" padding="lg">
Dot grid pattern background
</Container>
<Container background="stripes" padding="lg">
Diagonal stripes background
</Container>
<Container background="gradient-glow" padding="lg">
Glow gradient background
</Container>
<Container background="glassmorphism" padding="lg">
Glassmorphism background
</Container>
<Container background="mesh-gradient" padding="lg">
Mesh gradient background
</Container>
<Container background="noise" padding="lg">
Noise texture background
</Container>
<Container background="animated-gradient" padding="lg">
Animated gradient background
</Container>Usage
In Components
<Container background="primary">
Primary background
</Container>
<Container background="success/20">
Success background with 20% opacity
</Container>
<Container background="gradient-sky">
Sky gradient background
</Container>
<Container background="dot-grid">
Pattern background (dot grid)
</Container>In Builder Pattern
const props = ContainerProps()
.background("primary/20")
.build();
<Container {...props}>
Builder pattern background
</Container>Related Components
The following components support background color properties:
Container- Container componentCard- Card componentButton- Button componentAlert- Alert componentBadge- Badge componentModal- Modal component
