Skip to content

Proposal: Support true color in Colorize #5900

Closed
@wooster0

Description

@wooster0

Many terminals today support true color with ANSI escape sequences.

Here's an example:

puts "\e[38;2;100;255;100mI'm green\e[0m"

This would colour the text in a nice bright green color:
I'm green

Another example:

puts "\e[48;2;100;50;30mMy background is brown like wood\e[0m"

This would colour the background brown:

My background is brown like wood

We can colour our texts in exactly 16777216 colors!

Heres a rainbow:

loop do
  print "\r\e[38;2;#{rand(0..255)};#{rand(0..255)};#{rand(0..255)}mI am a rainbow\e[0m"
  sleep 0.1
end

Rainbow

Right now Colorize doesn't supports any other colors than these:

black
red
green
yellow
blue
magenta
cyan
light_gray
dark_gray
light_red
light_green
light_yellow
light_blue
light_magenta
light_cyan
white

Having 16777200 more colors than this would be a good feature I think.

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