lib/vedeu/colours/foreground.rb in vedeu-0.8.3 vs lib/vedeu/colours/foreground.rb in vedeu-0.8.4
- old
+ new
@@ -15,9 +15,22 @@
# @return [Boolean]
def foreground?
present?(to_s)
end
+ # @return [String]
+ def to_ast
+ return '' unless foreground?
+
+ if rgb?
+ ":fg_#{colour.to_s.slice(1..-1)}"
+
+ else
+ ':fg'
+
+ end
+ end
+
# @return [Hash<Symbol => String>]
def to_h
{
foreground: colour.to_s
}