Skip to content

Instantly share code, notes, and snippets.

@xeger
Last active January 25, 2023 12:24
Show Gist options
  • Save xeger/ceca893a4490fd87d3d4c69d8a481c30 to your computer and use it in GitHub Desktop.
Save xeger/ceca893a4490fd87d3d4c69d8a481c30 to your computer and use it in GitHub Desktop.
Custom themes for IRB::Color
begin
c = IRB::Color
token_seq_exprs = IRB::Color::const_get(:TOKEN_SEQ_EXPRS)
# TODO: italics; see https://github.com/microsoft/vscode/issues/49236
# TODO: how to customize method names (cyan or bold cyan I think?)
# TODO: what about TOKEN_SEQ_KEYWORDS? do we care?
one_dark = {
on_comment: [c::CLEAR], # needs italics
on_const: [c::YELLOW, c::BOLD],
on_label: [c::YELLOW],
on_kw: [c::MAGENTA],
on_tstring_beg: [c::GREEN, c::BOLD],
on_tstring_content: [c::GREEN],
on_tstring_end: [c::GREEN, c::BOLD],
}
one_dark.each_pair do |token, theme_colors|
if stdconfig = token_seq_exprs[token]
stdconfig[0] = theme_colors
end
end
end
@xeger
Copy link
Author

xeger commented May 3, 2022

Save this file as ~/.irbrc and edit to suit your liking. one_dark is the "One Dark Pro" theme, originally from Atom editor, which I also use with Mac OS Terminal and with Visual Studio Code.

(I don't care so much about the theme colors -- I just use it because it's available for all of the tools on my system!)

@hakunin
Copy link

hakunin commented Jan 25, 2023

Thanks for sharing!

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