Skip to content

Custom Colours - R,G,B values for KDE Konsole (or gnome-terminal) style when piping #166

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ghost opened this issue Mar 15, 2014 · 2 comments

Comments

@ghost
Copy link

ghost commented Mar 15, 2014

Hey Kornelius,

With coderay one can parse or colourize ruby code even on the commandline.

For instance:

cat foo.rb | coderay -ruby

would colourize as can be seen on this partial screenshot:

http://oi61.tinypic.com/2iijx50.jpg

Now, in KDE konsole, I recently found out that you can
use R,G,B values.

Here is an example, from kde konsole itself:

http://oi61.tinypic.com/dqna6r.jpg

So far so fine.

Now I was thinking that it would be nice if I could tell coderay
to use these colour codes instead.

The gem that outputs the KDE colour codes is
gem install konsole_colours

The ansi escape code that should work in kde konsole is this:

puts "\e[38;2;#{222};#{131};#{141}m Hello world!"

To test; you can see the 3 values here; R,G,B ... 222, 131, 141

Would it be possible to use coderay to also use this scheme, optionally?
If so, how and where?

I think what I would need is a simple way to overrule the default colour
codes used. Some way to make it permanent, perhaps in a new file,
or if I can somehow load this palette into Coderay. The gem
konsole_colours already provides the proper values, i.e.
I can do:

KonsoleColours['slateblue']

=> "\e[38;2;106;90;205m\e[0;0m\e[0;37m"

And the proper R,G,B values are returned.

I can easily change this to return an array with three
values, representing R,G,B.

Do you think there is any way to load up custom colours into
Coderay?

@ghost
Copy link
Author

ghost commented Mar 15, 2014

test (sorry, my connection broke down ...)

@korny
Copy link
Member

korny commented Mar 21, 2014

CodeRay is optimized for HTML, actually. I only added terminal support later.

My plan is still to integrate 256color support through the Paint gem (#118). This would allow for nicer colors.

There's no plan currently to allow terminal color "schemes". The Style definitions are basically CSS files. If anything, I'd like to have color schemes that can be used for both HTML and the terminal.

It's interesting that KDE has support for full RGB colors. That would certainly make things a bit easier.

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

No branches or pull requests

1 participant