Skip to content

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

Open
@ghost

Description

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions