# Rainbow (Swift)

> Text colour, background colour and styles for terminal output in Swift

Source: https://talira.ai/catalog/rainbow-swift-gmvkvpp5
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Library
- Categories: [libraries / terminal ui](https://talira.ai/categories/libraries/terminal-ui), [languages / swift](https://talira.ai/categories/languages/swift)
- Licence: MIT[^1]
- Pricing: Free and open source[^1]
- Pricing notes: Free and open source (MIT).
- Free tier: yes[^1]
- Supports: [NO_COLOR](https://talira.ai/standards/no-color.md)[^2], [FORCE_COLOR](https://talira.ai/standards/force-color.md)[^2]
- Backed by: [Wei Wang](https://talira.ai/orgs/onevcat.md)

Rainbow is a Swift library by Wei Wang that adds text colour, background colour and styles to console output, on Apple platforms and Linux. A String extension gives chainable properties such as .red, .onBlue and .bold, plus ANSI 256-colour, 24-bit true colour, hex and HSL colours, and nesting inside string interpolation. It writes plain text when output isn't a terminal (a log file, say), honours NO_COLOR and FORCE_COLOR, and has a builder and batch styling for hot paths. It isn't the Ruby gem of the same name.

## Links

- GitHub: https://github.com/onevcat/Rainbow

## Problems it solves

- colour my Swift command-line tool's output on macOS and Linux
- coloured log lines in the terminal but plain text when my Swift tool writes to a file
- bold and coloured text in a Swift CLI without writing ANSI escape codes by hand

## Features

- chainable colour and style properties on String
- ANSI 256-colour, 24-bit, hex and HSL colours
- plain output when not writing to a terminal
- NO_COLOR and FORCE_COLOR support
- builder pattern and batch styling for performance

## Trust

Overall: 0.49 out of 1.
Signals: maintenance 0.65, adoption 0.66, momentum 0.36, community 0.49, backing 0.30, extensibility 0.00.

- last commit 13 days ago
- 8 commits in the last 90 days
- latest release 4.2.2 2 months ago
- 1.9k GitHub stars
- 16 contributors
- backed by Wei Wang

## Sources

[^1]: https://github.com/onevcat/Rainbow/blob/master/LICENSE (checked 29 Nov 2026)
[^2]: https://github.com/onevcat/Rainbow/blob/master/README.md (checked 29 Nov 2026)
