Module: ActualDbSchema::OutputFormatter

Included in:
Commands::Rollback, GitHooks, MultiTenant, Patches::MigrationContext
Defined in:
lib/actual_db_schema/output_formatter.rb

Overview

Provides functionality for formatting terminal output with colors

Constant Summary collapse

UNICODE_COLORS =
{
  red: 31,
  green: 32,
  yellow: 33,
  gray: 90
}.freeze

Instance Method Summary collapse

Instance Method Details

#colorize(text, color) ⇒ Object



13
14
15
16
# File 'lib/actual_db_schema/output_formatter.rb', line 13

def colorize(text, color)
  code = UNICODE_COLORS.fetch(color, 37)
  "\e[#{code}m#{text}\e[0m"
end