Skip to content

Add text helpers for background colors#1624

Merged
0x1eef merged 4 commits intopry:masterfrom
SaladFork:feature/background-color-helpers
Aug 20, 2017
Merged

Add text helpers for background colors#1624
0x1eef merged 4 commits intopry:masterfrom
SaladFork:feature/background-color-helpers

Conversation

@SaladFork
Copy link
Copy Markdown
Contributor

Pry::Helpers::Text defines useful methods for coloring text, but it does not offer similarly for coloring the background. This PR adds that ability through methods such as black_on_green and bright_cyan_on_yellow.

I originally tried to implement it in an additive way (similar to how you can combine the bold helper with red to get text that is both bold and red), but unfortunately foreground and background colors must be defined together.

I used this approach to create a Powerline-like Pry prompt.

@0x1eef
Copy link
Copy Markdown
Contributor

0x1eef commented Aug 20, 2017

Very cool!
I like the Powerline-like prompt a lot.
Are you interested in creating another PR to add the prompt to Pry?
You would add it to Pry::Prompt::MAP: https://github.com/pry/pry/blob/master/lib/pry/prompt.rb
Then you could type change-prompt powerline to use it.

@0x1eef
Copy link
Copy Markdown
Contributor

0x1eef commented Aug 20, 2017

Travis failure is the known ruby2.4 segfault.

@0x1eef 0x1eef merged commit 36eaae8 into pry:master Aug 20, 2017
0x1eef pushed a commit that referenced this pull request Aug 21, 2017
0x1eef pushed a commit that referenced this pull request Aug 23, 2017
@SaladFork
Copy link
Copy Markdown
Contributor Author

Thanks for taking this the rest of the way!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants