# Styling Guide
Complete guide to styling and customization in the Hugo Saasify Theme. Learn how to customize colors, typography, components, and create your own design system.
## Table of Contents
- [Tailwind CSS Integration](#tailwind-css-integration)
- [Color System](#color-system)
- [Typography](#typography)
- [Custom Components](#custom-components)
- [Responsive Design](#responsive-design)
- [Syntax Highlighting](#syntax-highlighting)
- [Customization](#customization)
- [Best Practices](#best-practices)
## Tailwind CSS Integration
The Hugo Saasify Theme is built with Tailwind CSS v3, providing a utility-first approach to styling.
### How It Works
1. **Main CSS File**: `themes/chill-theme/assets/scss/main.scss`
2. **Tailwind Config**: `tailwind.config.js` (copied to site root during installation)
3. **PostCSS Config**: `postcss.config.js` (copied to site root during installation)
4. **Hugo Processing**: Automatic PostCSS compilation
5. **Build Stats**: Required for PurgeCSS optimization
### Configuration File
**Location**: `tailwind.config.js` (in your site root)
During installation, you copied this file from `themes/chill-theme/tailwind.config.copy.js` to your site root as `tailwind.config.js`.
```javascript
module.exports = {
content: ["./layouts/**/*.html"],
theme: {
extend: {
colors: {
primary: { /* custom colors */ },
secondary: { /* custom colors */ }
},
fontFamily: {
sans: ['Inter', 'system-ui', 'sans-serif'],
heading: ['Plus Jakarta Sans', 'sans-serif']
}
}
},
plugins: [
require('@tailwindcss/forms'),
require('@tailwindcss/typography')
]
}
```
### Tailwind Plugins
The theme includes two official plugins:
1. **@tailwindcss/forms** - Beautiful form styling
2. **@tailwindcss/typography** - Prose content styling
## Color System
The theme uses a comprehensive color palette with primary and secondary colors.
### Primary Colors
Blue-based palette for main brand elements.
```javascript
primary: {
50: '#eef1fc', // Lightest
100: '#dde3f9',
200: '#bbc7f3',
300: '#99abec',
400: '#778fe6',
500: '#5573df', // Base
600: '#425ad6', // Main (default)
700: '#3548ab',
800: '#283680',
900: '#1b2456' // Darkest
}
```
### Secondary Colors
Purple-based palette for accents and highlights.
```javascript
secondary: {
50: '#faf5ff', // Lightest
100: '#f3e8ff',
200: '#e9d5ff',
300: '#d8b4fe',
400: '#c084fc',
500: '#a855f7', // Base
600: '#9333ea', // Main (default)
700: '#7e22ce',
800: '#6b21a8',
900: '#581c87' // Darkest
}
```
### Using Colors
**In Templates**:
```html
Primary background
Secondary text
```
**In Custom CSS**:
```css
.custom-element {
@apply bg-primary-50 text-primary-900;
}
```
### Customizing Colors
To change the color scheme, edit `tailwind.config.js`:
```javascript
theme: {
extend: {
colors: {
primary: {
50: '#your-color',
100: '#your-color',
// ... continue for all shades
900: '#your-color'
}
}
}
}
```
**Quick Method** - Use a color palette generator:
1. Choose your base color
2. Generate shades using tools like [Tailwind Shades](https://tailwindshades.com/)
3. Replace values in `tailwind.config.js`
### Gray Scale
Default Tailwind gray scale is available:
```html
Light gray background
...
Dark gray background
```
## Typography
The theme uses two modern typefaces for optimal readability and visual appeal.
### Font Families
**Body Text**: Inter
- Variable font for optimal loading
- Used for all body text, UI elements
- Applied to: paragraphs, lists, forms, buttons
**Headings**: Plus Jakarta Sans
- Bold, modern sans-serif
- Used for all headings (h1-h6)
- Applied to: titles, section headers
### Font Configuration
**Tailwind Config**:
```javascript
fontFamily: {
sans: ['Inter', 'system-ui', 'sans-serif'],
heading: ['Plus Jakarta Sans', 'sans-serif']
}
```
**CSS Application**:
```css
body {
@apply font-sans text-gray-700;
}
h1, h2, h3, h4, h5, h6 {
@apply font-heading font-bold text-gray-900;
}
```
### Font Loading
Fonts are loaded via Google Fonts CDN in the base template:
```html
```
### Typography Scale
**Headings**:
```html
Main Heading
Section Heading
Subsection Heading
Small Heading
```
**Body Text**:
```html
Normal text (16px)
Large text (18px)
XL text (20px)
Small text (14px)
```
### Custom Fonts
To use different fonts:
1. **Add Font Files** to `static/fonts/` or use CDN
2. **Update Tailwind Config**:
```javascript
fontFamily: {
sans: ['Your Font', 'system-ui', 'sans-serif'],
heading: ['Your Heading Font', 'sans-serif']
}
```
3. **Load Font** in baseof.html or CSS
## Custom Components
Pre-built component classes for common UI elements.
### Buttons
**Primary Button**:
```html
Get Started
```
CSS:
```css
.btn {
@apply inline-flex items-center justify-center px-6 py-3 font-medium transition duration-200 ease-in-out;
border-radius: 2rem;
}
.btn-primary {
@apply btn bg-primary-600 text-white hover:bg-primary-700 hover:scale-105;
}
```
**Secondary Button**:
```html
Learn More
```
**Outline Button**:
```html
View Demo
```
### Cards
**Standard Card**:
```html
```
CSS:
```css
.feature-grid {
@apply grid gap-8 md:grid-cols-2 lg:grid-cols-3;
}
```
## Responsive Design
The theme is mobile-first and fully responsive.
### Breakpoints
Tailwind's default breakpoints:
```javascript
sm: '640px', // Small devices
md: '768px', // Medium devices
lg: '1024px', // Large devices
xl: '1280px', // Extra large devices
2xl: '1536px' // 2X large devices
```
### Responsive Utilities
**Responsive Visibility**:
```html
Visible on medium screens and up
Visible only on small screens
```
**Responsive Spacing**:
```html
Responsive padding
```
**Responsive Grid**:
```html
```
**Responsive Text**:
```html
Responsive heading
```
### Mobile Menu
The header includes a responsive mobile menu that automatically adapts to smaller screens.
## Syntax Highlighting
Code blocks are styled with custom syntax highlighting.
### Configuration
**Hugo Config** (`hugo.toml`):
```toml
[markup.highlight]
noClasses = false
lineNos = true
codeFences = true
guessSyntax = true
lineNumbersInTable = true
```
### Highlight Styles
**Base Styles**:
```css
.highlight {
@apply text-sm font-mono text-gray-200;
}
```
**Syntax Colors**:
```css
/* Keywords */
.highlight .k, .highlight .kd {
@apply text-purple-400 font-semibold;
}
/* Functions */
.highlight .nf, .highlight .nx {
@apply text-blue-400;
}
/* Strings */
.highlight .s, .highlight .s1, .highlight .s2 {
@apply text-green-400;
}
/* Numbers */
.highlight .mi, .highlight .mf {
@apply text-orange-400;
}
/* Comments */
.highlight .c, .highlight .c1, .highlight .cm {
@apply text-gray-500 italic;
}
/* Operators */
.highlight .o {
@apply text-yellow-400;
}
/* Punctuation */
.highlight .p {
@apply text-gray-400;
}
```
### Line Numbers
Line numbers are styled with table layout for better copy/paste experience:
```css
.highlight table td:first-child {
@apply pr-4 text-right select-none text-gray-500 border-r border-gray-700;
}
```
### Customizing Syntax Theme
To use a different color scheme, modify the `.highlight` classes in `assets/scss/main.scss`.
## Prose Styling
Blog posts and content pages use prose styling.
### Prose Classes
The theme includes custom prose styling:
```css
.prose {
@apply max-w-none;
}
.prose h1 {
@apply text-4xl mb-8;
}
.prose h2 {
@apply text-3xl mt-12 mb-6;
}
.prose h3 {
@apply text-2xl mt-8 mb-4;
}
.prose p {
@apply text-gray-700 leading-relaxed mb-6;
}
.prose a {
@apply text-primary-600 hover:text-primary-700 no-underline;
}
.prose ul, .prose ol {
@apply my-6 ml-6;
}
.prose blockquote {
@apply border-l-4 border-gray-200 pl-4 italic text-gray-700 my-8;
}
.prose code:not(pre code) {
@apply bg-gray-100 text-gray-900 px-1.5 py-0.5 rounded text-sm font-mono;
}
```
### Using Prose
Wrap content in prose class:
```html
{{ .Content }}
```
## Customization
### Adding Custom CSS
1. **Create Custom CSS File**:
`static/css/custom.css`
```css
/* Your custom styles */
.my-custom-class {
background: linear-gradient(to right, #your-colors);
}
```
2. **Add to Configuration**:
```toml
[params]
customCSS = ["css/custom.css"]
```
### Extending Tailwind
**Add to `tailwind.config.js`**:
```javascript
module.exports = {
theme: {
extend: {
// Custom spacing
spacing: {
'128': '32rem',
'144': '36rem'
},
// Custom colors
colors: {
'brand': '#your-color'
},
// Custom border radius
borderRadius: {
'xl': '1.5rem',
'2xl': '2rem'
}
}
}
}
```
### Overriding Component Styles
To override existing components:
1. **Copy Original** from `themes/.../assets/scss/main.scss`
2. **Add to Your CSS** in project root `assets/css/custom.css`
3. **Import After Main** in your build process
Or use `@layer` directive:
```css
@layer components {
.btn-primary {
@apply bg-red-600 hover:bg-red-700;
}
}
```
### Custom Color Scheme
Complete color scheme override:
```javascript
// tailwind.config.js in your site root
module.exports = {
theme: {
extend: {
colors: {
primary: {
50: '#f0f9ff',
100: '#e0f2fe',
// ... your colors
900: '#0c4a6e'
},
secondary: {
// ... your secondary palette
}
}
}
}
}
```
### Dark Mode Support
To add dark mode support:
1. **Enable in Tailwind Config**:
```javascript
module.exports = {
darkMode: 'class', // or 'media'
// ...
}
```
2. **Add Dark Variants**:
```html
Content
```
3. **Toggle Script** (add to baseof.html):
```javascript
// Dark mode toggle logic
```
## Best Practices
### 1. Use Tailwind Utilities First
Prefer Tailwind utilities over custom CSS:
```html
```
### 2. Extract Repeated Patterns
For repeated patterns, create component classes:
```css
@layer components {
.product-card {
@apply bg-white rounded-2xl p-6 shadow-sm hover:shadow-lg transition;
}
}
```
### 3. Maintain Consistency
Use the theme's design tokens:
- Colors from the palette
- Spacing from the scale
- Typography from defined classes
### 4. Optimize for Performance
- Use PurgeCSS (automatic with Hugo)
- Minimize custom CSS
- Avoid `!important`
- Use efficient selectors
### 5. Accessibility
- Maintain color contrast ratios (WCAG AA minimum)
- Use semantic HTML
- Include focus states
- Test with keyboard navigation
### 6. Mobile-First
Build mobile layouts first:
```html
```
### 7. Test Across Browsers
- Chrome/Edge (Chromium)
- Firefox
- Safari
- Mobile browsers
## Testing Styles
### Local Development
```bash
# Watch for changes
hugo server -D
# Clear cache if styles don't update
hugo --gc
hugo server -D
```
### Build for Production
```bash
# Build with minification
hugo --minify
# Check file sizes
ls -lh public/css/
```
### Browser Testing
1. Chrome DevTools - Responsive mode
2. Firefox Developer Tools
3. Safari Web Inspector
4. Real device testing
## Related Documentation
- [CONFIGURATION.md](CONFIGURATION.md) - Theme configuration
- [LAYOUTS.md](LAYOUTS.md) - Layout templates
- [CONTENT-CREATION.md](CONTENT-CREATION.md) - Creating content
- [TROUBLESHOOTING.md](TROUBLESHOOTING.md) - Common issues
## Additional Resources
- [Tailwind CSS Documentation](https://tailwindcss.com/docs)
- [Tailwind CSS Typography Plugin](https://tailwindcss.com/docs/typography-plugin)
- [Hugo Asset Processing](https://gohugo.io/hugo-pipes/)
- [PostCSS Documentation](https://postcss.org/)