
Security News
Critical Security Vulnerability in React Server Components
React disclosed a CVSS 10.0 RCE in React Server Components and is advising users to upgrade affected packages and frameworks to patched versions now.
colorful
Advanced tools
Colorful is a gem that provides color and effect support to native Ruby Strings when printed in an ANSI color supporting terminal.
The following code will print "Test" in red using the terminal's color scheme:
puts "Test".red
Background colors are also supported:
puts "Test".blue_background
You can combine the two:
puts "Test".red.blue_background
or:
puts "Test".red_on_blue
Add some effects:
puts "Test".red_on_blue.blink.underline
And then remove some:
puts "Test".red_on_blue.blink.underline.no_blink
The supported terminal colors are:
The supported effects are:
Note that not all of these formats may not be supported in all environments. Using an unsupported effect will not cause any display issues, other than the style not being applied.
Additionally, Colorful supports full rgb256 or HTML color values
To use rgb256 true red as the foreground:
puts "Test".color(255, 0, 0)
For the HTML version:
puts "Test".color("F00")
or:
puts "Test".color("#ff0000")
or:
puts "Test".color(:_ff0000)
These methods handle standard or shortened HTML codes, case insensitive, with or without # or _
Note that these methods require xterm 256 color support, and colors will be translated to the nearest possible valid color.
Lastly, some methods have been added that allow for cursor movement. The supported movement operations include:
To return to the beginning of the line:
10.times do |n|
print n.to_s.and_go_to 0
end
or:
10.times do |n|
puts n.to_s.and_go_up 1
end
Note that some methods work better with puts, and others with print. Puts will implicitly add a new line to the end of the string it is printing, moving the cursor.
This is a work in progress but is stable. Let me know if you would like a feature added to the project.
FAQs
Unknown package
We found that colorful demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
React disclosed a CVSS 10.0 RCE in React Server Components and is advising users to upgrade affected packages and frameworks to patched versions now.

Research
/Security News
We spotted a wave of auto-generated “elf-*” npm packages published every two minutes from new accounts, with simple malware variants and early takedowns underway.

Security News
TypeScript 6.0 will be the last JavaScript-based major release, as the project shifts to the TypeScript 7 native toolchain with major build speedups.