ColorSense Blog
How to Build a Website Color Palette That Works in Real Layouts
Learn how to assign website colors to backgrounds, text, buttons, links, borders, forms, and status messages, then test them in real layouts.
A useful website color palette is not just a group of colors that look good together. It is a small decision system that tells you which color belongs on the page background, which one carries body text, which one signals the main action, and which ones support links, borders, forms, focus states, and messages.
That role assignment is what turns a palette into something a designer, founder, marketer, or developer can reuse.
A row of swatches may feel finished, but it cannot tell you whether a button is readable, whether a form field is easy to identify, or whether an error message still makes sense without color. Those questions only appear when the colors are placed inside a real interface.
What a website color palette needs to do
A brand palette and a website palette are connected, but they do not always contain the same values.
A brand palette may include expressive colors for logos, packaging, photography, campaigns, and social content. A website palette must also support practical interface roles.
Depending on the site, those roles may include:
- Page background
- Cards and secondary surfaces
- Body text
- Headings
- Primary and secondary actions
- Links
- Borders and dividers
- Form fields
- Focus and selected states
- Success, warning, error, and informational messages
The exact number of colors depends on the interface. A small portfolio may use a compact system. An online store or software product may need more states and surface levels.
Start with the smallest set that covers the jobs your website actually has.
Begin with interface roles, not favorite colors
Before choosing final colors, list the elements that appear on the website.
For a simple marketing site, that list might include:
- Main page background
- Card background
- Body text
- Heading text
- Main call-to-action button
- Secondary button
- Text links
- Borders
- Form inputs
A more complex site may also need disabled controls, selected navigation items, alerts, dashboards, charts, and dark-mode surfaces.
This step prevents two common mistakes.
The first is choosing too many colors because they look interesting. The second is choosing too few colors to support the interface clearly.
A good palette should reduce decisions. It should not create a new debate every time someone designs a card, form, or landing page.
Use a website color palette generator as a starting point
A website color palette generator can help you explore possible colors or review colors already associated with a website.
The ColorSense Website Palette page should remain the main tool destination for this search intent. Use it as the starting point for working with website colors, then use the steps below to decide how those colors should behave in the interface.
Treat any generated or collected colors as candidates, not final decisions.
A starting palette may contain:
- Several shades that are too similar
- A bright color that works only as an accent
- A brand color that is unsuitable for body text
- A neutral that works on desktop but feels too faint on mobile
- Colors inherited from an older version of the site
The next step is to organize the candidates by role.
Build the system around semantic color roles
Semantic roles describe what a color does rather than what it looks like.
For example, primary action is more useful than dark blue. The value can change later while the role remains the same.
This approach also makes handoff easier. Major design systems use role-based color concepts because the same color value may serve different purposes across themes and components.
A practical website system can begin with the following roles.
Main background
The main background covers most of the page.
It should support long-form reading, images, cards, forms, and repeated components without competing for attention.
It can be white, off-white, a pale neutral, or a dark surface. The important question is whether the foreground colors assigned to it remain clear and readable.
Secondary surface
A secondary surface separates cards, sidebars, menus, form sections, or featured content from the main background.
The difference can be subtle, but it should still communicate structure. If the two surfaces are too similar, the layout may depend entirely on shadows or borders. If they are too different, every card may feel like a separate visual block.
Primary text
Primary text handles essential reading content such as body copy, navigation labels, form labels, and instructions.
Test it on every surface where it appears. A text color that works on the main page background may fail on a tinted card or colored footer.
For WCAG 2.2 Level AA, normal text requires a contrast ratio of at least 4.5:1 against its background. Large text requires at least 3:1.
Secondary text
Secondary text supports captions, timestamps, metadata, descriptions, and helper copy.
It should look quieter than primary text without becoming hard to read.
Do not create secondary text by lowering opacity and assuming the result will work. Test the final rendered foreground and background combination.
Primary action
The primary action color belongs to the most important action on the page.
Examples include:
- Start free
- Book a call
- Buy now
- Continue
- Submit
The button needs more than a background color. It also needs a readable label, a visible focus state, and clear hover, pressed, and disabled treatments.
The brightest brand color is not automatically the best choice. A primary action should stand out from the layout without making the entire page feel visually loud.
Secondary action
Secondary actions should remain discoverable without competing with the main action.
They may use a neutral fill, an outline, a lighter surface, or a text-only treatment.
Examples include “Learn more,” “Go back,” and “View details.”
The difference between primary and secondary actions should be obvious at a glance.
Link color
Link color
Links need a consistent treatment that distinguishes them from regular text.
Color can help, but it should not always do all the work. Underlines, weight, or another visible cue can make links easier to recognize.
Test links in body copy, cards, navigation areas, footers, and colored sections. One link color may not work on every surface.
Borders and dividers
Borders help users identify cards, fields, tables, and groups.
When a border is necessary to identify a control, such as a text field, the visual information used to show that control generally needs at least 3:1 contrast against adjacent colors under WCAG 2.2 non-text contrast guidance.
A border can be subtle and still functional. The goal is not to outline every object. It is to clarify where one element ends and another begins.
Focus and selected states
Keyboard focus must be visible.
WCAG 2.2 Success Criterion 2.4.11 is Focus Not Obscured (Minimum) at Level AA. Focus Appearance is Success Criterion 2.4.13 at Level AAA.
Even when a project targets Level AA, a clear focus indicator is an important practical requirement. Test it against every background where the control can appear.
Selected states also need more than a slight hue shift when that shift is difficult to notice. Use a combination of color, shape, border, icon, or label when necessary.
Status colors
Success, warning, error, and informational messages need defined treatments.
Do not rely on red, green, yellow, or blue alone to carry meaning. Add text labels, icons, or clear messages.
A status color may appear as text, an icon, a border, a badge, or a tinted background. Each actual combination should be tested separately.
A practical starter structure
A small website may begin with these core roles:
- Main background
- Secondary surface
- Primary text
- Secondary text
- Primary action
- Secondary action
- Link
- Border
Add status and focus roles when the interface needs them.
Some roles can share the same value. For example, a dark neutral may be used for both body text and a footer background in different contexts. A brand hue may serve both links and primary buttons, provided each real combination remains readable and visually clear.
The point is not to reach a particular number. The point is to cover every necessary role without adding redundant colors.
Turn brand colors into website roles
Imagine a brand palette with deep blue, warm orange, pale cream, soft green, and charcoal.
Using every color equally would weaken the hierarchy.
A clearer assignment might be:
- Pale cream for the main background
- White or a nearby neutral for cards
- Charcoal for body text and headings
- Deep blue for primary actions and links
- Soft green for secondary sections
- Warm orange for small highlights or selected details
This is only a role example. The final HEX values and foreground-background combinations must be verified before publication or implementation.
The important lesson is that brand colors do not need equal screen space. Each one should have a controlled responsibility.
Test the palette in one realistic section
Do not approve the palette while it is still displayed only as swatches.
Create a representative page section containing:
- A page background
- A heading
- A paragraph
- A text link
- A primary button
- A secondary button
- A card
- A form field
- A small status message
Apply the proposed colors and review the section without the original mood board beside it.
Ask:
- Is the body text comfortable to read?
- Does the primary action attract attention first?
- Is the secondary action visibly less important?
- Are links recognizable inside paragraphs?
- Can users identify the form field?
- Does the focus indicator remain visible?
- Does the status message communicate meaning without color alone?
- Can cards be distinguished from the page background?
This test reveals problems that a palette strip cannot show.
Check contrast by pair, not by palette
A palette does not pass or fail accessibility as one object.
Specific foreground and background pairs do.
Test combinations such as:
- Primary text on the main background
- Secondary text on the main background
- Primary text on cards
- Button labels on button backgrounds
- Links on every approved surface
- Form borders against adjacent backgrounds
- Focus indicators against surrounding colors
- Status text and icons against status surfaces
Use the ColorSense WCAG Contrast Checker for the text and background combinations you plan to publish.
WCAG thresholds should be treated as exact thresholds, not rounded estimates. A calculated result below 4.5:1 does not pass the 4.5:1 requirement simply because it appears close.
Thin fonts and anti-aliasing can also make text appear fainter than its CSS value suggests. Passing the ratio is the baseline. Test the real font, size, weight, and device as well.
Do not use a fixed percentage rule as a formula
The 60-30-10 rule can be a useful reminder that one color should dominate while accents remain limited.
It should not be treated as a required website formula.
A checkout page, dashboard, landing page, and blog article may use very different proportions. Website color is shaped by components and content, not only by surface area.
A more dependable principle is:
- Let neutral colors handle most of the structure.
- Use brand colors to create hierarchy.
- Reserve the strongest accent for moments that need attention.
Name colors by role for developer handoff
Once the system is approved, document each role with its final value and intended use.
CSS custom properties make repeated values easier to manage because one value can be defined once and reused throughout the stylesheet.
A role-based structure may look like:
:root {
--color-bg: [VERIFY HEX];
--color-surface: [VERIFY HEX];
--color-text: [VERIFY HEX];
--color-text-muted: [VERIFY HEX];
--color-action-primary: [VERIFY HEX];
--color-action-secondary: [VERIFY HEX];
--color-link: [VERIFY HEX];
--color-border: [VERIFY HEX];
--color-focus: [VERIFY HEX];
--color-success: [VERIFY HEX];
--color-warning: [VERIFY HEX];
--color-error: [VERIFY HEX];
}
Name tokens by function rather than appearance. --color-action-primary remains accurate even when the brand changes from blue to purple. --color-dark-blue does not.
For each role, record:
- Final HEX value
- Approved foregrounds and backgrounds
- Components that use it
- Hover, pressed, focus, selected, and disabled states
- Accessibility results
- Accessibility results
- Restrictions
This turns the palette into a usable handoff rather than a loose list of codes.
Common website color palette mistakes
Choosing colors before listing roles
When colors are chosen first, unsuitable shades often get forced into text, buttons, and backgrounds.
List the interface roles before finalizing the palette.
Giving every brand color equal weight
When all brand colors compete for attention, users cannot tell which action or message matters most.
Choose one clear primary action color and let the other colors support it.
Making secondary text too faint
Secondary text still needs to be readable.
Test captions, helper copy, timestamps, and metadata at their real size.
Using the same treatment for links and decorative text
Visitors should not have to guess whether colored text is interactive.
Use a consistent link style.
Forgetting focus and selected states
Default, hover, pressed, focus, selected, and disabled states may need different treatments.
A palette that documents only the default state is incomplete.
Using color as the only status signal
Pair status colors with an icon, label, or explanatory message.
Testing only on desktop
Mobile layouts make weak hierarchy, faint text, and crowded actions easier to notice.
Test representative sections on both wide and narrow screens.
A website palette should reduce future decisions
The best website color palette is not the most colorful one.
It is the one that helps a team answer practical questions consistently:
- Which background belongs here?
- Which color carries body text?
- What should the main button look like?
- How are links recognized?
- How does keyboard focus appear?
- How are errors and success messages communicated?
- Which combinations are approved?
Start with the ColorSense Website Palette page, then organize the colors into semantic roles and test those roles in a realistic interface.
The result is more than a collection of swatches. It is a website color system that can be designed, coded, reviewed, and reused with less guesswork.
FAQ Block
What is a website color palette?
A website color palette is a defined set of colors assigned to interface roles such as backgrounds, text, buttons, links, cards, borders, focus states, and status messages.
How many colors should a website color palette have?
There is no universal number. Start with the smallest set that covers the website’s required roles, then add colors only when they solve a clear interface need.
What is the difference between a brand palette and a website palette?
A brand palette supports the wider visual identity. A website palette assigns brand and neutral colors to practical interface roles and may add focus, status, border, and surface values.
How do I create a website color palette?
List the interface roles, choose candidate colors, assign one or more values to each role, test them in a realistic page section, verify the actual foreground-background combinations, and document the approved values.
Can I use one brand color for both links and buttons?
Yes, provided each use remains clear, readable, and distinguishable in its real context. A shared hue may need different shades or treatments for different roles.
How do I know whether website colors are accessible?
Test the actual text, control, border, icon, focus, and background combinations. Normal text generally needs at least 4.5:1 contrast at WCAG 2.2 Level AA, while large text needs at least 3:1. Necessary visual information for active controls and states generally needs at least 3:1 against adjacent colors.
Should status colors match the brand palette?
They can relate to the brand, but clarity comes first. Status messages should remain understandable through text, icons, or labels rather than color alone.
Try it now
Check any color pair against WCAG — free, no signup
Pick a foreground and background, see the exact contrast ratio plus AA/AAA verdicts for normal and large text. One click auto-fixes a failing pair while keeping your hue.
Open WCAG Contrast Checker →