Color Sentences in Text
Color each sentence in your text with a unique color. Visualize sentence structure, improve readability, and export colored text as HTML.
About
Sentence boundary detection is harder than it appears. A period after Dr or U.S.A is not a sentence end. This tool parses text using punctuation-aware splitting, assigning each sentence Si a color from a cyclic palette of 12 distinct hues. The color index follows c = i mod n, where n is the palette size. Misidentifying sentence boundaries corrupts the visual map. The tool handles common abbreviations and ellipses to reduce false splits.
Applications include proofreading long-form writing, analyzing sentence length variation, teaching grammar structure, and preparing annotated texts. The output can be copied as rich text or exported as a standalone HTML file. Note: the parser approximates English sentence boundaries. Heavily abbreviated or non-standard text (code, legal citations) may produce unexpected splits.
Formulas
Each sentence Si in the input text is assigned a color from a palette of size n using modular arithmetic:
Where i is the zero-based sentence index and n = 12 for the default palette. This ensures colors cycle after every n sentences. The sentence boundary regex uses the pattern:
A post-processing step merges fragments that follow known abbreviations (e.g., Mr., Dr., e.g.) back into the preceding sentence. The word count per sentence is computed as:
Where Wi = word count of sentence i, Si = the i-th sentence string, palette = array of CSS color hex values, n = palette length (12).
Reference Data
| Palette | Color 1 | Color 2 | Color 3 | Color 4 | Color 5 | Color 6 | Best For |
|---|---|---|---|---|---|---|---|
| Rainbow | #E74C3C | #E67E22 | #F1C40F | #27AE60 | #3498DB | #9B59B6 | Maximum contrast between adjacent sentences |
| Pastel | #E8A0BF | #95C8D8 | #B5D6A7 | #F0C27B | #C3AED6 | #F7B7A3 | Soft documents, presentations |
| Warm | #C0392B | #D35400 | #E74C3C | #E67E22 | #F39C12 | #F1C40F | Emphasis on energy, urgency |
| Cool | #1ABC9C | #2ECC71 | #3498DB | #2980B9 | #8E44AD | #16A085 | Calm, professional documents |
| High Contrast | #FF0000 | #0000FF | #008000 | #FF6600 | #800080 | #006666 | Accessibility, visual impairment |
| Earth | #8B4513 | #556B2F | #B8860B | #6B8E23 | #A0522D | #2E8B57 | Natural, organic feel |
| Sentence Length Benchmarks | |||||||
| Very Short | 1 - 8 words | Punchy, impactful. Common in fiction dialogue. | |||||
| Short | 9 - 15 words | Ideal for web content. Flesch-Kincaid friendly. | |||||
| Medium | 16 - 25 words | Standard academic and journalistic prose. | |||||
| Long | 26 - 40 words | Complex arguments. Risk of reader fatigue. | |||||
| Very Long | > 40 words | Legal, technical. Consider splitting. | |||||
| Common Abbreviations (Not Sentence Ends) | |||||||
| Mr. | Mrs. | Dr. | Prof. | Sr. | Jr. | Honorifics | |
| vs. | etc. | e.g. | i.e. | approx. | dept. | Latin & General | |
| Jan. | Feb. | Mar. | Apr. | Aug. | Oct. | Month abbreviations | |