Primary Color Palette
Thecolors array in config/livewire-tables.php defines the primary color used across all interactive elements:
- Buttons — Filter, column visibility, and bulk action buttons
- Checkboxes — Row selection and column toggles
- Active states — Sorted columns, active filters, selected rows
- Badges — Filter chips and counts
- Focus rings — Keyboard navigation indicators
- Hover effects — Interactive element highlights
- Pagination — Active page indicator
Color customization works identically for both Tailwind and Bootstrap themes. You don’t need separate configurations.
How It Works
The color values are injected as CSS custom properties in the:root scope:
resources/views/components/styles.blade.php:2-9
Color Presets
The package includes six professionally designed color presets that you can use as-is or as starting points:- Teal (Default)
- Indigo
- Sky
- Purple
- Rose
- Amber
Custom Colors
You can use any hex color values for your palette. Here’s how to create a custom color scheme:Generate Color Shades
Create lighter and darker variations. You can:
- Use Tailwind’s color palette as reference
- Use ColorBox to generate harmonious shades
- Use Palette Generator for quick generation
Color Shade Usage Guide
| Shade | Purpose | Examples |
|---|---|---|
| 50 | Subtle backgrounds, hover states | Button hover, selection bar background |
| 100 | Light backgrounds, secondary hover | Filter button active state, table hover |
| 200 | Chips, badges, borders (light mode) | Active filter chips, ring colors |
| 400 | Medium contrast borders | Filter button active border, hover borders |
| 500 | Focus rings, icons | Form input focus, sort icons |
| 600 | Primary actions, checkboxes | Buttons, selected checkboxes, badges |
| 700 | Text, strong emphasis | Active text, sorted column headers |
Shades 300, 800, and 900 are not used by the package. You only need to define seven specific shades.
CSS Custom Properties Reference
All CSS custom properties available for direct override:Primary Color Variables
resources/views/components/styles.blade.php:2-18
Overriding in Your CSS
You can override any CSS custom property in your application’s stylesheet:Utility Classes
The package generates utility classes that use the configured color palette:Background Classes
.lt-bg-50— Lightest background.lt-bg-600— Primary button background.lt-bg-700— Dark primary background.lt-bg-50-muted— 70% opacity light background
Text Classes
.lt-text-400— Medium contrast text.lt-text-500— Base primary text.lt-text-600— Strong primary text.lt-text-700— Strongest primary text
Border Classes
.lt-border-100— Light border.lt-border-400— Medium border.lt-border-600— Strong border
Hover Classes
.lt-hover-bg-100— Light hover background.lt-hover-bg-700— Dark hover background.lt-hover-text-600— Hover text color.lt-hover-theme— Combined hover effect (background + text + border)
Button Classes
.lt-btn-primary— Solid primary button.lt-btn-outline-primary— Outlined primary button.lt-btn-neutral— Neutral gray button.lt-btn-neutral-active— Active neutral button
Badge Classes
.lt-badge-primary— Solid badge.lt-badge-primary-soft— Soft/muted badge
Checkbox Classes
.lt-checkbox— Styled checkbox using primary color
resources/views/components/styles.blade.php:20-76
Per-Component Color Overrides
For one-off customizations on specific tables, use inline styles or scoped CSS:Framework-Specific Styling
Depending on your chosen theme, different CSS classes are applied:Tailwind Theme
Uses utility classes + CSS custom properties:Bootstrap Theme
Uses Bootstrap classes + CSS custom properties:The same
colors configuration works for both themes. The package handles the framework-specific implementation.Accessibility Considerations
When customizing colors, ensure you maintain sufficient contrast ratios:Check Contrast Ratios
Use a tool like WebAIM Contrast Checker:
- Shade 600 on white should have ≥4.5:1 ratio (WCAG AA)
- Shade 700 text on shade 50 background should have ≥4.5:1 ratio
- White text on shade 600 should have ≥4.5:1 ratio
Test with Color Blindness Simulators
Use browser DevTools or online tools to simulate different types of color blindness
Performance Notes
CSS custom properties have excellent performance characteristics:- No JavaScript — All color changes are pure CSS
- No Repaints — Changing a custom property is very efficient
- Small Bundle Size — ~12KB of generated CSS (minified)
- Cached — Styles are cached by the browser
Troubleshooting
Colors not updating
- Clear config cache:
php artisan config:clear - Clear view cache:
php artisan view:clear - Hard refresh browser: Ctrl+Shift+R (Windows/Linux) or Cmd+Shift+R (Mac)
- Check syntax: Ensure hex colors include the
#prefix
Colors look wrong in dark mode
The primary color should work in both light and dark modes. If it doesn’t:- Use medium shades (500-700) for dark mode primary actions
- Avoid very light shades on dark backgrounds
- Test both modes when choosing colors
CSS not being applied
Make sure your custom CSS is loaded after the Livewire Tables styles:Next Steps
Themes
Learn about the theme system and create custom themes
Dark Mode
Configure dark mode with custom color palettes