|
| 1 | +--- |
| 2 | +description: 'Color usage guidelines and styling rules for HTML elements to ensure accessible, professional designs.' |
| 3 | +applyTo: '**/*.html, **/*.css, **/*.js' |
| 4 | +--- |
| 5 | + |
| 6 | +# HTML CSS Style Color Guide |
| 7 | + |
| 8 | +Follow these guidelines when updating or creating HTML/CSS styles for browser rendering. Color names |
| 9 | +represent the full spectrum of their respective hue ranges (e.g., "blue" includes navy, sky blue, etc.). |
| 10 | + |
| 11 | +## Color Definitions |
| 12 | + |
| 13 | +- **Hot Colors**: Oranges, reds, and yellows |
| 14 | +- **Cool Colors**: Blues, greens, and purples |
| 15 | +- **Neutral Colors**: Grays and grayscale variations |
| 16 | +- **Binary Colors**: Black and white |
| 17 | +- **60-30-10 Rule** |
| 18 | + - **Primary Color**: Use 60% of the time (*cool or light color*) |
| 19 | + - **Secondary Color**: Use 30% of the time (*cool or light color*) |
| 20 | + - **Accent**: Use 10% of the time (*complementary hot color*) |
| 21 | + |
| 22 | +## Color Usage Guidelines |
| 23 | + |
| 24 | +Balance the colors used by applying the **60-30-10 rule** to graphic design elements like backgrounds, |
| 25 | +buttons, cards, etc... |
| 26 | + |
| 27 | +### Background Colors |
| 28 | + |
| 29 | +**Never Use:** |
| 30 | + |
| 31 | +- Purple or magenta |
| 32 | +- Red, orange, or yellow |
| 33 | +- Pink |
| 34 | +- Any hot color |
| 35 | + |
| 36 | +**Recommended:** |
| 37 | + |
| 38 | +- White or off-white |
| 39 | +- Light cool colors (e.g., light blues, light greens) |
| 40 | +- Subtle neutral tones |
| 41 | +- Light gradients with minimal color shift |
| 42 | + |
| 43 | +### Text Colors |
| 44 | + |
| 45 | +**Never Use:** |
| 46 | + |
| 47 | +- Yellow (poor contrast and readability) |
| 48 | +- Pink |
| 49 | +- Pure white or light text on light backgrounds |
| 50 | +- Pure black or dark text on dark backgrounds |
| 51 | + |
| 52 | +**Recommended:** |
| 53 | + |
| 54 | +- Dark neutral colors (e.g., #1f2328, #24292f) |
| 55 | +- Near-black variations (#000000 to #333333) |
| 56 | + - Ensure background is a light color |
| 57 | +- Dark grays (#4d4d4d, #6c757d) |
| 58 | +- High-contrast combinations for accessibility |
| 59 | +- Near-white variations (#ffffff to #f0f2f3) |
| 60 | + - Ensure background is a dark color |
| 61 | + |
| 62 | +### Colors to Avoid |
| 63 | + |
| 64 | +Unless explicitly required by design specifications or user request, avoid: |
| 65 | + |
| 66 | +- Bright purples and magentas |
| 67 | +- Bright pinks and neon colors |
| 68 | +- Highly saturated hot colors |
| 69 | +- Colors with low contrast ratios (fails WCAG accessibility standards) |
| 70 | + |
| 71 | +### Colors to Use Sparingly |
| 72 | + |
| 73 | +**Hot Colors** (red, orange, yellow): |
| 74 | + |
| 75 | +- Reserve for critical alerts, warnings, or error messages |
| 76 | +- Use only when conveying urgency or importance |
| 77 | +- Limit to small accent areas rather than large sections |
| 78 | +- Consider alternatives like icons or bold text before using hot colors |
| 79 | + |
| 80 | +## Gradients |
| 81 | + |
| 82 | +Apply gradients with subtle color transitions to maintain professional aesthetics. |
| 83 | + |
| 84 | +### Best Practices |
| 85 | + |
| 86 | +- Keep color shifts minimal (e.g., #E6F2FF to #F5F7FA) |
| 87 | +- Use gradients within the same color family |
| 88 | +- Avoid combining hot and cool colors in a single gradient |
| 89 | +- Prefer linear gradients over radial for backgrounds |
| 90 | + |
| 91 | +### Appropriate Use Cases |
| 92 | + |
| 93 | +- Background containers and sections |
| 94 | +- Button hover states and interactive elements |
| 95 | +- Drop shadows and depth effects |
| 96 | +- Header and navigation bars |
| 97 | +- Card components and panels |
| 98 | + |
| 99 | +## Additional Resources |
| 100 | + |
| 101 | +- [Color Tool](https://civicactions.github.io/uswds-color-tool/) |
| 102 | +- [Government or Professional Color Standards](https://designsystem.digital.gov/design-tokens/color/overview/) |
| 103 | +- [UI Color Palette Best Practices](https://www.interaction-design.org/literature/article/ui-color-palette) |
| 104 | +- [Color Combination Resource](https://www.figma.com/resource-library/color-combinations/) |
0 commit comments