Sha256: 88be96f32ddc637edfb26e81104a71d81010edcb2b2def7e25c9b465b85d4486
Contents?: true
Size: 705 Bytes
Versions: 5
Compression:
Stored size: 705 Bytes
Contents
require 'json' require 'virtus' require_relative '../support/esc' module Vedeu class Colour include Virtus.model attribute :foreground, String, default: '' attribute :background, String, default: '' def foreground @fg ||= Esc.foreground_colour(css_foreground) end def background @bg ||= Esc.background_colour(css_background) end def css_foreground @foreground end def css_background @background end def to_json(*args) as_hash.to_json end def to_s foreground + background end def as_hash { foreground: css_foreground, background: css_background, } end end end
Version data entries
5 entries across 5 versions & 1 rubygems