Color Palette Generation: Theory and Practice
Generating harmonious color palettes requires understanding color theory. Learn the algorithms behind complementary, analogous, triadic, and split-complementary palettes.
虚拟数据生成器
生成逼真的虚拟数据用于测试和开发
Color Harmony Rules
Color harmony describes combinations that are aesthetically pleasing. These rules are based on positions on the color wheel (HSL/HSV hue values 0-360 degrees).
Complementary Colors
Two colors opposite each other on the color wheel (180 degrees apart). Example: blue (240°) and orange (60°). Complementary pairs create high contrast and visual tension. Use one color as the dominant and the other as an accent — equal amounts of complementary colors compete for attention.
Analogous Colors
Three to five colors adjacent on the color wheel (within 30-60 degrees of each other). Example: blue (240°), blue-green (180°), green (120°). Analogous palettes feel harmonious and natural but can lack contrast. Add a neutral or a single complementary accent to create a focal point.
Triadic Colors
Three colors evenly spaced on the color wheel (120 degrees apart). Example: red (0°), green (120°), blue (240°). Triadic palettes are vibrant and balanced. Let one color dominate and use the other two as accents to prevent visual chaos.
Split-Complementary
Start with a base color, then use the two colors adjacent to its complement. Example: blue (240°) with yellow-orange (45°) and red-orange (15°). This provides the contrast of complementary colors with less tension, making it more forgiving for beginners.
Generating Accessible Palettes
Color harmony is only half the story — your palette must also meet accessibility requirements. Ensure text colors have at least 4.5:1 contrast ratio against their backgrounds (WCAG AA). Test your palette with color blindness simulations (deuteranopia, protanopia, tritanopia). Provide sufficient lightness variation so that the palette remains distinguishable in grayscale.
Algorithmic Generation
Start with a seed color and apply the harmony rule to generate companion colors. Adjust saturation and lightness to create variants: lighter tints for backgrounds, darker shades for text, and muted versions for secondary elements. Most palette generators use this approach with user-adjustable parameters.
相关工具
相关格式
相关指南
How to Generate Strong Random Passwords
Password generation requires cryptographic randomness and careful character selection. This guide covers the principles behind strong password generation, entropy calculation, and common generation mistakes to avoid.
UUID vs ULID vs Snowflake ID: Choosing an ID Format
Choosing the right unique identifier format affects database performance, sorting behavior, and system architecture. This comparison covers UUID, ULID, Snowflake ID, and NanoID for different application requirements.
Lorem Ipsum Alternatives: Realistic Placeholder Content
Lorem Ipsum has been the standard placeholder text since the 1500s, but realistic placeholder content produces better design feedback. This guide covers alternatives and best practices for prototype content.
How to Generate Color Palettes Programmatically
Algorithmic color palette generation creates harmonious color schemes from a single base color. Learn the math behind complementary, analogous, and triadic palettes and how to implement them in code.
Troubleshooting Random Number Generation Issues
Incorrect random number generation causes security vulnerabilities, biased results, and non-reproducible tests. This guide covers common RNG pitfalls and how to verify your random numbers are truly random.