Sha256: 38216cb75fbd0e9a81f9b69fd8e761381ef0005ef5e9c93d53858ad6bea4cee7
Contents?: true
Size: 850 Bytes
Versions: 18
Compression:
Stored size: 850 Bytes
Contents
# frozen_string_literal: true require 'colorized_string' module Dsu module Support module ColorThemable def prompt_with_options(prompt:, options:) options = "[#{options.join('/')}]" "#{apply_theme(prompt, theme_color: self.prompt)} " \ "#{apply_theme(options, theme_color: prompt_options)}" \ "#{apply_theme('>', theme_color: self.prompt)}" end module_function def apply_theme(input, theme_color:) if input.is_a?(Array) return input.map do |string| colorize_string(string, theme_color: theme_color) end.join("\n") end colorize_string(input, theme_color: theme_color) end private def colorize_string(input, theme_color:) ColorizedString[input].colorize(**theme_color) end end end end
Version data entries
18 entries across 18 versions & 1 rubygems