Skip to content

Commit

Permalink
[README] Document Rainbow.uncolor method (#135)
Browse files Browse the repository at this point in the history
[README] Document `Rainbow.uncolor` method
  • Loading branch information
garyhtou authored Jan 14, 2025
1 parent 138bc05 commit 2892645
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,18 @@ calls:
Rainbow("hola!").blue.bright.underline
```

The `Rainbow` module also provides an `uncolor` method for stripping away any
existing color or formatting. This may be handy for determining the visual
length of strings.

```ruby
text = Rainbow("this is green!").green
# => "\e[32mthis is green!\e[0m"

Rainbow.uncolor(text)
# => "this is green!"
```

### Refinement

If you want to use the Refinements version, you can:
Expand Down

0 comments on commit 2892645

Please sign in to comment.