Skip to main content
rule official · GitHub

html-css-style-color-guide — GitHub Copilot rule: colors and setup

This rule guides color choices for HTML and CSS, from backgrounds and text to gradients. Use it when editing browser-facing styles and checking contrast.

Install into GitHub Copilot · Manually: put the files in place All methods and platforms ↓
.github/instructions/html-css-style-color-guide.instructions.md
Open on GitHub

What html-css-style-color-guide does

The rule applies to **/*.html, **/*.css, and **/*.js when creating or changing styles. It organizes a palette with the 60-30-10 split: primary color, secondary color, then accent. For backgrounds, it favors light cool shades and neutrals; gradients should stay within one color family.

For readable text, pair light backgrounds with dark neutrals, or dark backgrounds with near-white shades. Yellow text and light text on a light background are out. Low-contrast combinations should be avoided as well. Hot colors such as red, orange, and yellow are reserved for small accents or alerts, so they do not belong across large background areas.

What it helps with

  • choose a background color for an HTML page
  • distribute interface colors with the 60-30-10 rule
  • avoid text that blends into its background
  • style a gradient within one color family

Example prompts for the agent

  • Update the background and text colors in index.html using this rule.
  • Check whether the button and card styles follow the 60-30-10 split.
  • Revise the page header gradient to follow the rule's guidance.

How to install html-css-style-color-guide

Manually: put the files in place

.github/instructions/html-css-style-color-guide.instructions.md

The applyTo field sets which files it applies to

Step by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use

Questions about html-css-style-color-guide

How do I install html-css-style-color-guide for GitHub Copilot?

Add the rule file to your project at .github/instructions/html-css-style-color-guide.instructions.md.

What does html-css-style-color-guide do?

It sets color guidance for HTML and CSS, covering backgrounds, text contrast, palette balance, and gradients.

Which colors does the rule reject for backgrounds?

It rules out hot colors, including red, orange, and yellow, along with pink, purple, and magenta. Light cool shades and neutral tones are recommended instead.

Source text

html-css-style-color-guide.instructions.md · MIT
---
description: 'Color usage guidelines and styling rules for HTML elements to ensure accessible, professional designs.'
applyTo: '**/*.html, **/*.css, **/*.js'
---

# HTML CSS Style Color Guide

Follow these guidelines when updating or creating HTML/CSS styles for browser rendering. Color names
represent the full spectrum of their respective hue ranges (e.g., "blue" includes navy, sky blue, etc.).

## Color Definitions

- **Hot Colors**: Oranges, reds, and yellows
- **Cool Colors**: Blues, greens, and purples
- **Neutral Colors**: Grays and grayscale variations
- **Binary Colors**: Black and white
- **60-30-10 Rule**
  - **Primary Color**: Use 60% of the time (*cool or light color*)
  - **Secondary Color**: Use 30% of the time (*cool or light color*)
  - **Accent**: Use 10% of the time (*complementary hot color*)

## Color Usage Guidelines

Balance the colors used by applying the **60-30-10 rule** to graphic design elements like backgrounds,
buttons, cards, etc...

### Background Colors

**Never Use:**

- Purple or magenta
- Red, orange, or yellow
- Pink
- Any hot color

**Recommended:**

- White or off-white
- Light cool colors (e.g., light blues, light greens)
- Subtle neutral tones
- Light gradients with minimal color shift

### Text Colors

**Never Use:**

- Yellow (poor contrast and readability)
- Pink
- Pure white or light text on light backgrounds
- Pure black or dark text on dark backgrounds

**Recommended:**

- Dark neutral colors (e.g., #1f2328, #24292f)
- Near-black variations (#000000 to #333333)
  - Ensure background is a light color
- Dark grays (#4d4d4d, #6c757d)
- High-contrast combinations for accessibility
- Near-white variations (#ffffff to #f0f2f3)
  - Ensure background is a dark color

### Colors to Avoid

Unless explicitly required by design specifications or user request, avoid:

- Bright purples and magentas
- Bright pinks and neon colors
- Highly saturated hot colors
- Colors with low contrast ratios (fails WCAG accessibility standards)

### Colors to Use Sparingly

**Hot Colors** (red, orange, yellow):

- Reserve for critical alerts, warnings, or error messages
- Use only when conveying urgency or importance
- Limit to small accent areas rather than large sections
- Consider alternatives like icons or bold text before using hot colors

## Gradients

Apply gradients with subtle color transitions to maintain professional aesthetics.

### Best Practices

- Keep color shifts minimal (e.g., #E6F2FF to #F5F7FA)
- Use gradients within the same color family
- Avoid combining hot and cool colors in a single gradient
- Prefer linear gradients over radial for backgrounds

### Appropriate Use Cases

- Background containers and sections
- Button hover states and interactive elements
- Drop shadows and depth effects
- Header and navigation bars
- Card components and panels

## Additional Resources

- [Color Tool](https://civicactions.github.io/uswds-color-tool/)
- [Government or Professional Color Standards](https://designsystem.digital.gov/design-tokens/color/overview/)
- [UI Color Palette Best Practices](https://www.interaction-design.org/literature/article/ui-color-palette)
- [Color Combination Resource](https://www.figma.com/resource-library/color-combinations/)

© github · MIT · github/awesome-copilot

Similar IDE rules

All IDE rules for Frontend and UI →

From the same set770

The whole set →
java-upgrade A rule that points Copilot at the java-upgrade skill whenever you change the Java version in Maven or Gradle files. Handy for LTS jumps. ★ 40,418repo stars java-mcp-server Development guide for creating Java-based MCP servers using the official MCP Java SDK 2.x. It guides project setup, transport choices, and tool registration. ★ 40,418repo stars intellij-java-kotlin A rule that keeps Copilot inside the project's build model when working on Java and Kotlin in IntelliJ IDEA, with validation that matches CI. ★ 40,418repo stars instructions Standardized structure and guidelines for writing custom GitHub Copilot instruction files with target globs. ★ 40,418repo stars go Enforces idiomatic Go practices based on Effective Go and the Google style guide. It keeps package structures clean and avoids nested branching. ★ 40,418repo stars github-actions-ci-cd-best-practices A GitHub Copilot rule that guides workflow structure, token permissions, caching and matrix setups whenever you touch files under .github/workflows/. ★ 40,418repo stars gilfoyle-code-review Turns GitHub Copilot into the sardonic systems architect from Silicon Valley. It delivers ruthless code critiques on architecture, speed, and security flaws without sugar-coating. ★ 40,418repo stars generate-modern-terraform-code-for-azure This rule guides GitHub Copilot when it works on Azure Terraform files, from provider selection to validation. Use it to shape infrastructure code in .tf files. ★ 40,418repo stars

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor