Skip to content

Instantly share code, notes, and snippets.

@havenwood
Created January 13, 2021 07:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save havenwood/5409cbd4f2538accbb9c1a8c1f1329d3 to your computer and use it in GitHub Desktop.
Save havenwood/5409cbd4f2538accbb9c1a8c1f1329d3 to your computer and use it in GitHub Desktop.
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