tailwind-best-practices.mdc 1.8 KB

123456789101112131415161718192021222324252627282930313233
  1. ---
  2. description: Best practices for Tailwind CSS
  3. globs: *.vue
  4. alwaysApply: false
  5. ---
  6. - Implement responsive design with Tailwind's responsive modifiers
  7. - All colors and themes should be consistent with the overall UI element-plus. Please refer to `src/theme/element.scss`
  8. - Customize Tailwind's default theme using `tailwind.config.js`
  9. - Use `@apply` directive for component-level styling
  10. ## Dark Mode Guidelines
  11. - **Color Variables**: Use CSS custom properties defined in `src/theme/dark.scss` for dark mode colors
  12. - **Primary Colors**:
  13. - Background: `--next-bg-main` (#17202a) - Twitter standard dark background
  14. - Text: `--next-color-white` (#f7f9f9) - Primary text color
  15. - Accent: `#1d9bf0` - Twitter blue for active states and links
  16. - **Component Colors**:
  17. - Disabled background: `--next-color-disabled` (#202e3a)
  18. - Hover states: `--next-color-hover` (#1e2732) or `--next-color-hover-rgba` (rgba(239, 243, 244, 0.1))
  19. - Borders: `--next-border-color` (#38444d) or `--next-border-black` (#2f3336)
  20. - **Text Colors**:
  21. - Regular text: `--next-text-color-regular` (#8b98a5)
  22. - Placeholder text: `--next-text-color-placeholder` (#536471)
  23. - **Consistency Rules**:
  24. - Always use `[data-theme='dark']` selector for dark mode styles
  25. - Maintain Twitter-inspired color scheme consistency
  26. - Use semi-transparent overlays for hover effects: `rgba(29, 155, 240, 0.1)` for primary, `rgba(239, 243, 244, 0.1)` for neutral
  27. - **Component Specific**:
  28. - Cards: Background `--next-color-disabled` with `--next-border-color` borders
  29. - Buttons: Use defined CSS variables, avoid hardcoded colors
  30. - Forms: Input background `#273340`, border `#38444d`, focus with Twitter blue accent
  31. - Tables: Header background `#1c2732`, hover `--next-color-hover`
  32. - **Avoid**: Hardcoded hex colors in dark mode, use CSS variables for maintainability