Color in data

From FerroxLabs/murage · View interactive version

Color in data is an AI agent skill from the GitHub repository FerroxLabs/murage. Applies color to data visualizations by selecting sequential, diverging, or categorical palettes based on data type. Specifies hex codes for each element, ensures colorblind accessibility with WCAG contrast ratios, and documents usage rules. Use when the user needs to choose colors for charts, dashb

How to use this skill

Skill file

Color In Data

When to Use

Use this skill when:

Do NOT use when:


Process

Step 1: Identify What Color Is Actually Encoding

Before choosing any palette, establish the precise data-to-color mapping. This determines everything downstream.

Step 2: Select the Correct Palette Architecture

Sequential palettes -- for ordered, one-directional quantitative data:

Diverging palettes -- for ordered data with a meaningful, interpretable midpoint:

Categorical palettes -- for nominal data with no inherent order:

Highlight/emphasis palettes -- for single-element focus:

Step 3: Generate the Specific Color Set With Full Specifications

For every color in the palette, specify all of the following -- partial specification creates ambiguity in implementation:

For sequential and diverging palettes, also specify:

Step 4: Verify Colorblind Accessibility

Color vision deficiency affects approximately 8% of males and 0.5% of females of Northern European descent. Verification is non-optional.

Verification method without simulation software:

Alternative encoding requirements:

Step 5: Verify WCAG Contrast Ratios

WCAG 2.1 specifies contrast requirements that apply directly to data visualization text elements and large color blocks:

Contrast ratio calculation:

Common problem cases:

Step 6: Test the Palette as a System

Individual color correctness is necessary but not sufficient. Test the palette as a complete system:

Step 7: Document Usage Rules and Anti-Patterns

The color specification is only complete when the rules for using it correctly are written down:

Step 8: Deliver the Specification in the Structured Format

Compile all outputs from the previous steps into the Output Format defined below. Ensure every field is populated with specific values -- no field should be left as a placeholder or described with a general term.


Output Format

## Data Visualization Color Specification

### Palette Summary
- **Palette type:** [Sequential / Diverging / Categorical / Highlight]
- **Color encoding:** [Exact description of what color represents, e.g., "Revenue deviation from 2023 baseline in USD"]
- **Number of colors:** [N]
- **Visualization context:** [Chart type, tool/platform, screen/print, background color]
- **Accessibility target:** [WCAG AA / WCAG AAA / Section 508 / Internal only]

---

### Color Assignments

| # | Name | Hex | RGB | HSL | Assigned To | On-Color Text |
|---|------|-----|-----|-----|-------------|---------------|
| 1 | [name] | #[hex] | [R, G, B] | [H°, S%, L%] | [data value or category] | #[FFFFFF or 1A1A1A] |
| 2 | [name] | #[hex] | [R, G, B] | [H°, S%, L%] | [data value or category] | #[FFFFFF or 1A1A1A] |
| 3 | [name] | #[hex] | [R, G, B] | [H°, S%, L%] | [data value or category] | #[FFFFFF or 1A1A1A] |
[Continue for all colors]

**[For sequential/diverging palettes only]**
- **Low endpoint:** #[hex] = [data value or label]
- **Midpoint (diverging only):** #[hex] = [data value or label, e.g., "$0" or "Average"]
- **High endpoint:** #[hex] = [data value or label]
- **Interpolation space:** [CIELAB / OKLCH / HSL] (note: avoid RGB)
- **Number of discrete steps:** [N, or "continuous gradient"]

---

### Accessibility Verification

#### WCAG Contrast Ratios

| Foreground Color | Background | Luminance Fg | Luminance Bg | Contrast Ratio | WCAG Level | Notes |
|------------------|------------|--------------|--------------|----------------|------------|-------|
| #[hex] [name] | #[bg hex] | [L value] | [L value] | [ratio]:1 | [AA / AA Large / AAA / Fail] | [any caveat] |
[Repeat for every foreground-background pair that appears in the visualization]

#### Colorblind Simulation Results

| Color Pair | Deuteranopia | Protanopia | Tritanopia | Luminance Diff | Safe? |
|-----------|-------------|-----------|-----------|----------------|-------|
| [color A] vs [color B] | [appearance] | [appearance] | [appearance] | [delta L] | [Yes / Conditional / No] |
[Repeat for every pair that must be distinguished]

#### Alternative Encoding Channels
- **Shape:** [e.g., "Line chart markers: circle (Series 1), square (Series 2), triangle up (Series 3)"]
- **Pattern:** [e.g., "Bar fills: solid (Category A), diagonal hatch 45° (Category B), cross-hatch (Category C)"]
- **Label:** [e.g., "Direct value labels on all bars -- color identity redundant"]
- **Position:** [e.g., "Grouped bars with explicit spacing -- position encoding is primary"]

---

### System Test Results
- **Simultaneous contrast issues:** [None identified / describe any problem and resolution]
- **Small size test (200×150px):** [All colors distinct / list any pairs that merge]
- **Grayscale test:** [List grayscale luminance values for each color and confirm distinctness]
- **Background compatibility:** [Confirmed on [color] background / list any issues]

---

### Usage Rules

1. **Category assignment is fixed:** [Color name] always represents [category] -- reassignment is not permitted across views or reports
2. **Overflow rule:** If a [N+1]th category is added, use #[hex] ([name]) as the overflow color -- do not add a new hue
3. **Opacity restriction:** All data colors used at 100% opacity. Transparency permitted only for [specify exception, e.g., density overlays]
4. **Highlighting protocol:** When emphasizing a single element, desaturate all non-highlighted elements to #[neutral gray hex] and use the assigned color at full saturation for the highlight
5. **Annotation colors:** Reference lines use #[hex], threshold bands use #[hex] at [N]% opacity -- these are reserved and must not duplicate any data encoding color
6. [Any additional context-specific rules]

### Do NOT Use
- [Anti-pattern specific to this palette, with reason]
- [Anti-pattern specific to this palette, with reason]
- [Anti-pattern specific to this palette, with reason]

Rules

  1. Never use red and green as the sole differentiators between two categories -- deuteranopia and protanopia together affect ~6-7% of males; in a presentation to 50 people, statistically 2-3 people cannot distinguish a pure red-green pair. Use Blue-Orange, Blue-Red, or Purple-Yellow-Green instead
  1. Always pair color with a second encoding channel -- color alone cannot communicate data to users with color vision deficiency, users viewing grayscale printouts, or users in poor lighting conditions; the second channel (shape, pattern, label, position) must convey the same categorical distinction independently
  1. Sequential palettes must encode low values as light and high values as dark -- this convention is universal and hardwired in audience expectations; reversing it (dark = low, light = high) causes systematic misreading, especially in choropleth maps where dark regions are instinctively read as "more"
  1. Limit categorical palettes to 7 colors maximum; prefer 5 or fewer -- beyond 7, preattentive color discrimination fails; audiences must consciously match each element to the legend, which destroys the purpose of color encoding; if more than 7 categories exist, group small categories into "Other" (#BEBEBE) and present a separate table for detail
  1. For diverging palettes, the midpoint must be neutral -- specifically, luminance ≥ 0.85 -- this corresponds to hex values like #F7F7F7, #FFFFFF, or #EFEFEF; a saturated midpoint creates false visual emphasis on the neutral region and makes it appear that mid-range values are the most significant
  1. Every hex code must be explicitly specified -- never describe a color as "blue" or "a lighter shade" -- color descriptions are ambiguous across tools; #4682B4 and #5B9BD5 are both "medium blue" but produce different contrast ratios and shift differently under color vision deficiency simulation
  1. Do not use RGB interpolation for sequential or diverging gradients -- RGB-interpolated gradients pass through a desaturated gray zone between certain hue pairs (blue to yellow becomes gray-green in the middle) and appear perceptually non-uniform; always specify CIELAB or OKLCH interpolation for any gradient
  1. Do not use rainbow / ROY G BIV palettes for sequential data -- rainbow palettes are perceptually non-uniform (yellow and cyan appear lighter than red and blue even at the same saturation), create false visual boundaries between hue transitions, and perform poorly under all three types of color vision deficiency simultaneously; they remain inappropriate regardless of audience familiarity with them
  1. Calculate WCAG contrast ratios using the correct luminance formula -- do not estimate by eye -- a color that looks high-contrast can have a ratio as low as 2:1; specifically, mid-range saturated colors (lightness 45-55% in HSL) at saturation 60%+ reliably deceive visual estimation; the formula is (L1 + 0.05) / (L2 + 0.05) with gamma-linearized RGB channels
  1. Annotation colors (reference lines, threshold bands, callout boxes) must not share any hue within 30° of any data encoding color -- annotation colors that are close in hue to data colors cause visual confusion about whether the annotation is a data point or a reference marker; annotation colors should be neutral (dark gray #3D3D3D for lines, light warm gray #F2EFE9 for background bands) unless the annotation itself is semantically color-coded
  1. Specify the intended background color in the palette documentation -- a palette designed for a white background (#FFFFFF) often fails on a light gray dashboard background (#F4F4F4) or a dark mode background (#1E1E1E); the contrast ratios change, some colors become invisible, and sequential palettes may need their endpoints adjusted
  1. When using opacity for overlapping elements (density plots, bubble overlap, choropleth with overlay), recalculate the effective displayed color at each opacity level -- 60% opacity of #4682B4 on white (#FFFFFF) displays as #90B4D3, which has a different contrast ratio and must be checked independently

Edge Cases

User Has a Brand Color That Must Be Used

Start by determining whether the brand color is being used as a data encoding color or a structural/decorative color (borders, backgrounds, title bar).

User Needs More Than 7 Categories

This is the most frequent categorical color problem and has exactly one correct solution structure:

Dark Mode / Dark Background Dashboard

Dark backgrounds (typically #121212 to #2D2D2D) require specific palette adjustments -- a white-background palette cannot be applied directly:

Print Visualization (CMYK Output)

Screen (sRGB) to print (CMYK) conversion introduces systematic color shifts that can corrupt a carefully designed palette:

Bivariate Color Encoding (Two Variables Simultaneously)

Bivariate maps and matrices encode two data dimensions in a single color -- this is an advanced technique that requires specific structure:

User Wants to Encode Uncertainty or Confidence

Visualizing statistical uncertainty through color is a specialized application with specific conventions:

Existing Visualization With Incorrect Colors

When a user brings an existing chart with problematic colors and asks for a fix:


Example

Input: "I'm building a dashboard in Power BI that shows monthly sales performance for 6 regional offices. The chart is a grouped bar chart with bars for each region per month. The dashboard background is dark gray (#1E1E1E). It needs to be accessible. I don't have any mandatory brand colors."


Data Visualization Color Specification

Palette Summary


Color Assignments

| # | Name | Hex | RGB | HSL | Assigned To | On-Color Text |

|---|------|-----|-----|-----|-------------|---------------|

| 1 | Azure | #56B4E9 | 86, 180, 233 | 202°, 77%, 63% | North Region | #1A1A1A |

| 2 | Vermillion | #E06033 | 224, 96, 51 | 20°, 72%, 54% | South Region | #1A1A1A |

| 3 | Bluish Green | #38B09A | 56, 176, 154 | 171°, 52%, 45% | East Region | #1A1A1A |

| 4 | Gold Amber | #E6A817 | 230, 168, 23 | 42°, 82%, 50% | West Region | #1A1A1A |

| 5 | Soft Violet | #A882DD | 168, 130, 221 | 269°, 57%, 69% | Central Region | #1A1A1A |

| 6 | Reddish Pink | #D4608C | 212, 96, 140 | 335°, 55%, 60% | Northwest Region | #1A1A1A |

Notes on hue spacing: Starting at 202° (Azure/blue), hues are spaced at approximately 50°-70° intervals (20°, 171°, 42°, 269°, 335°) to maximize perceptual distance. No two hues fall within 30° of each other. Saturation is consistent at 52-82% and lightness at 44-69%, tuned for visibility on a dark (#1E1E1E) background.


Accessibility Verification

WCAG Contrast Ratios (all measured against dark background #1E1E1E, luminance 0.014)

| Foreground Color | Background | Fg Luminance | Bg Luminance | Contrast Ratio | WCAG Level | Notes |

|-----------------|------------|-------------|-------------|----------------|------------|-------|

| #56B4E9 Azure | #1E1E1E | 0.399 | 0.014 | 8.5:1 | AAA | Excellent for bar fills and labels |

| #E06033 Vermillion | #1E1E1E | 0.206 | 0.014 | 5.6:1 | AA | Passes for text and large elements |

| #38B09A Bluish Green | #1E1E1E | 0.185 | 0.014 | 5.1:1 | AA | Passes for text and large elements |

| #E6A817 Gold Amber | #1E1E1E | 0.399 | 0.014 | 8.5:1 | AAA | Excellent; confirm not too similar to Azure in luminance |

| #A882DD Soft Violet | #1E1E1E | 0.256 | 0.014 | 6.7:1 | AA | Passes; check against Reddish Pink adjacency |

| #D4608C Reddish Pink | #1E1E1E | 0.145 | 0.014 | 4.1:1 | AA Large / 3:1 bar fills | Use for large bar elements; add direct label if used as text under 18pt |

| #1A1A1A (text) | #56B4E9 (bar) | 0.010 | 0.399 | 10.6:1 | AAA | Data labels on Azure bars |

| #1A1A1A (text) | #E06033 (bar) | 0.010 | 0.206 | 5.6:1 | AA | Data labels on Vermillion bars |

| #1A1A1A (text) | #38B09A (bar) | 0.010 | 0.185 | 5.1:1 | AA | Data labels on Bluish Green bars |

| #1A1A1A (text) | #E6A817 (bar) | 0.010 | 0.399 | 10.6:1 | AAA | Data labels on Gold Amber bars |

| #1A1A1A (text) | #A882DD (bar) | 0.010 | 0.256 | 6.7:1 | AA | Data labels on Soft Violet bars |

| #1A1A1A (text) | #D4608C (bar) | 0.010 | 0.145 | 4.1:1 | Use white text instead | Switch to #FFFFFF for text on Reddish Pink: 12.7:1 |

Colorblind Simulation Results

| Pair | Deuteranopia | Protanopia | Tritanopia | Grayscale Luminance Δ | Safe? |

|------|-------------|-----------|-----------|----------------------|-------|

| Azure vs. Vermillion | Distinguishable (blue vs. dark yellow-orange) | Distinguishable (blue vs. dark tan) | Distinguishable (appear as blue vs. yellow-red) | ΔL = 0.193 (193 pts) | Yes |

| Azure vs. Bluish Green | Distinguishable (blue vs. blue-gray, slight risk) | Distinguishable (blue vs. gray-green) | Problematic: both shift toward similar greenish-gray | ΔL = 0.214 | Conditional -- add shape markers |

| Vermillion vs. Reddish Pink | Both shift toward similar brown-orange | Both shift toward dark tan -- risk | Distinguishable | ΔL = 0.061 (61 pts) | Conditional -- ensure not adjacent in bar grouping |

| Gold Amber vs. Reddish Pink | Gold shifts toward bright yellow; Pink shifts toward orange-yellow -- risk of merge | Gold bright yellow; Pink dark tan -- distinguishable | Problematic: both accessible hue angles shift similarly | ΔL = 0.254 | Conditional -- add label redundancy |

| Soft Violet vs. Azure | Distinguishable (violet shifts toward blue but remains lighter) | Distinguishable | Distinguishable | ΔL = 0.143 | Yes |

| All 6 colors in grayscale | Grayscale values: Azure 0.399, Amber 0.399, Violet 0.256, Vermillion 0.206, Green 0.185, Pink 0.145 | -- | -- | Azure and Amber identical in gray | Separate Azure and Amber bars using spacing; add pattern fills |

Key finding from colorblind simulation: Azure (#56B4E9) and Gold Amber (#E6A817) have identical grayscale luminance (both ≈ 0.399). In an achromatic print or extreme CVD case, these two regions are indistinguishable. Resolution: assign Azure and Gold Amber to the two regions with the most data points (North and West, likely the highest revenue regions) and ensure they are never placed in adjacent bar positions within the same month grouping.

Alternative Encoding Channels

System Test Results


Usage Rules

  1. Fixed regional assignment: Azure (#56B4E9) is permanently North Region, Vermillion (#E06033) is permanently South Region, Bluish Green (#38B09A) is permanently East Region, Gold Amber (#E6A817) is permanently West Region, Soft Violet (#A882DD) is permanently Central Region, Reddish Pink (#D4608C) is permanently Northwest Region -- these assignments must not be changed between dashboard pages or reports
  2. Bar ordering within groups: Within each monthly bar group, bars must appear in the fixed order: Azure, Gold Amber, Bluish Green, Soft Violet, Vermillion, Reddish Pink -- this order separates the two most visually similar pairs (Azure/Amber are positions 1 and 2 but the color difference is large; Vermillion/Pink are positions 5 and 6, separated by 3 bars of contrasting color)
  3. Overflow rule: If a 7th region is added, use #BEBEBE (Neutral Gray) as the overflow color -- do not add a 7th hue; instead, the new region should be reviewed to determine whether it merits being promoted to replace one of the existing 6, or appears as "Other" until a full palette redesign
  4. Opacity restriction: All region colors at 100% opacity for bar fills. If a bar is selected/highlighted in Power BI interactivity, all non-selected bars reduce to 30% opacity of their assigned color; the selected bar stays at 100%
  5. Annotation colors: Monthly target line uses #F0F0F0 (Light Gray) at 80% opacity; year-over-year comparison line (if added) uses #FFFFFF at 60% opacity -- neither color falls within 30° hue angle of any of the 6 region colors
  6. Text on Reddish Pink: Any text, number, or label placed on a Reddish Pink (#D4608C) bar must use #FFFFFF (white), not #1A1A1A -- contrast of white on Reddish Pink is 12.7:1 (AAA); contrast of dark on Reddish Pink is 4.1:1 which is borderline for small text
  7. Light mode export: For PDF exports or external presentations on white backgrounds, the palette must be re-tuned: reduce lightness of each color by 12 points in HSL to maintain readability -- the dark-mode palette will appear washed out on white

Do NOT Use

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.