Skip to content

Instantly share code, notes, and snippets.

@havenwood

havenwood/oh_dear.rb

Created Jan 13, 2021
Embed
What would you like to do?
An, ahem, answer, of sorts for how to change default IRB colors (irc question)
changes = {IRB::Color::BLUE => IRB::Color::YELLOW}
IRB::Color.const_get(:TOKEN_SEQ_EXPRS).tap do |token_seq_exprs|
changes.each do |old_color, new_color|
token_seq_exprs.filter_map do |type, ((color, _), _)|
color == old_color && type
end.each do |matching_type|
token_seq_exprs.dig(matching_type, 0)[0] = new_color
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment