Module: TIntMe

Defined in:
lib/tint_me.rb,
lib/tint_me/error.rb,
lib/tint_me/style.rb,
lib/tint_me/version.rb,
lib/tint_me/sgr_builder.rb,
lib/tint_me/style/types.rb,
lib/tint_me/style/schema.rb

Overview

TIntMe - Functional terminal text styling with composable ANSI colors and effects

TIntMe provides an elegant, functional API for terminal text styling using ANSI escape codes. It features immutable Style objects that can be composed using the >> operator, supporting standard colors, hex values, and comprehensive text effects.

Examples:

Basic styling

require "tint_me"

# Create styles
red = TIntMe[foreground: :red]
bold = TIntMe[bold: true]

# Apply styling
puts red.call("Error!")
puts bold["Important"]

Style composition

base = TIntMe[foreground: :blue]
emphasis = TIntMe[bold: true, underline: true]
styled = base >> emphasis
puts styled.call("Highlighted text")

Hex colors

custom = TIntMe[foreground: "#FF6B35", background: "#F7931E"]
puts custom.call("Custom colors")

See Also:

Author:

  • OZAWA Sakuro

Defined Under Namespace

Classes: Error, SGRBuilder, Style

Constant Summary collapse

VERSION =

Current version of the TIntMe gem

Returns:

  • (String)

    The semantic version string

"1.1.0"

Class Method Summary collapse

Class Method Details

.[]Style

Shortcut method to create a Style instance with the given options

This is a convenience method that passes all arguments directly to Style.new. Accepts the same keyword arguments as Style#initialize.

Examples:

Basic usage

blue = TIntMe[foreground: :blue]
bold_red = TIntMe[foreground: :red, bold: true]
puts blue.call("Hello")  # => blue "Hello"

Immediate styling

puts TIntMe[foreground: :green, italic: true]["Success!"]

Returns:

  • (Style)

    A new Style instance

See Also:



59
60
61
# File 'lib/tint_me.rb', line 59

def self.[](...)
  Style.new(...)
end