Overview
The Dev Showcase portfolio uses CSS custom properties (CSS variables) defined inbase.css for consistent theming and easy customization.
Location: wwwroot/css/base.css
Root Variables
All CSS variables are defined in the:root selector, making them globally available:
Color Variables
Background Colors
—color-bg-primary
Value:#0a0a0a (near black)
Usage: Main background color for the entire application.
- Body background
- Main content areas
- Base layer elements
—color-bg-secondary
Value:#111111 (dark gray)
Usage: Secondary background for elevated elements.
- Cards and panels
- Modal backgrounds
- Sidebar elements
- Language selector
- Filter buttons (default state)
—color-bg-tertiary
Value:#1a1a1a (lighter dark gray)
Usage: Tertiary background for interactive elements.
- Button default state
- Hover states
- Input fields
- Nested containers
Text Colors
—color-text-primary
Value:#ffffff (white)
Usage: Primary text color for headings and important content.
- All headings (h1-h6)
- Active navigation items
- Button active states
- Emphasized text
—color-text-secondary
Value:rgba(255, 255, 255, 0.7) (70% opacity white)
Usage: Secondary text for body content and descriptions.
- Paragraph text
- Button default text
- Card descriptions
- Subtitles
—color-text-tertiary
Value:rgba(255, 255, 255, 0.45) (45% opacity white)
Usage: Tertiary text for less important content and placeholders.
- Placeholder text
- Disabled states
- Timestamps
- Metadata
Accent Colors
—color-accent-red
Value:#ff1744 (bright red)
Usage: Primary accent color for CTAs and active states.
- Active filter buttons
- Active language selector
- Link hover states
- Primary call-to-action buttons
- Highlight elements
—color-accent-red-light
Value:#ff4569 (lighter red)
Usage: Lighter variant of accent red for hover and focus states.
Applied to:
- Hover effects
- Focus rings
- Lighter accent variations
—color-accent-btn-hover
Value:rgba(255, 255, 255, 0.08) (8% opacity white)
Usage: Subtle hover effect for buttons and interactive elements.
- Button hover backgrounds
- Interactive element hover states
- Subtle highlights
Border Colors
—color-border
Value:rgba(255, 255, 255, 0.08) (8% opacity white)
Usage: Default border color for subtle separations.
- Card borders
- Container borders
- Language selector border
- Dividers
—color-border-hover
Value:#404040 (medium gray)
Usage: Border color for hover states.
- Hover border effects
- Active element borders
- Focus borders
Transition Variables
—transition-speed
Value:0.3s
Usage: Standard transition duration across the application.
- Color transitions
- Opacity changes
- Transform animations
- All interactive element transitions
—transition-easing
Value:cubic-bezier(0.25, 0.46, 0.45, 0.94)
Usage: Standard easing function for smooth, natural animations.
- Ease-out-like timing
- Smooth acceleration/deceleration
- Natural feeling motion
- All transitions and animations
- Hover effects
- State changes
- Transform animations
Usage Examples
Using Variables in CSS
Overriding Variables
You can override variables for specific sections:JavaScript Access
Access CSS variables from JavaScript:Theming with CSS Variables
Creating a Light Theme
Override variables to create a light theme:Creating Custom Color Schemes
Define custom accent colors:Variable Naming Convention
CSS variables follow a consistent naming pattern:--color-bg-primary: Color > Background > Primary--color-text-secondary: Color > Text > Secondary--color-accent-red-light: Color > Accent > Red (Light variant)--transition-speed: Transition > Speed
Browser Support
CSS custom properties are supported in all modern browsers:- Chrome 49+
- Firefox 31+
- Safari 9.1+
- Edge 15+
Benefits of CSS Variables
Maintainability
Change values in one place to update across entire application:Consistency
Ensures consistent values across all components:Dynamic Theming
Easy to implement theme switching:Performance
CSS variables update efficiently without recalculating entire stylesheets.Best Practices
Use Semantic Names
Prefer semantic names over descriptive:Group Related Variables
Organize variables by category:Document Variable Usage
Add comments for complex variables:Related Files
wwwroot/css/base.css: Variable definitionswwwroot/css/site.css: Main stylesheet using variableswwwroot/css/responsive.css: Responsive styles- All other CSS files inherit these variables