Module: Coco::FormatHelper

Defined in:
app/helpers/coco/format_helper.rb

Instance Method Summary collapse

Instance Method Details

#format_css_hex_color(color) ⇒ Object

Ensures a hex color has a ‘#` prefix for use in CSS style values



5
6
7
8
9
# File 'app/helpers/coco/format_helper.rb', line 5

def format_css_hex_color(color)
  if color.present?
    "#" + color.to_s.delete_prefix("#")
  end
end