Sha256: cc2cd09ce8633398af531aebe31239ad7c9f168a5e6ae94b69dd5da2be9fc66a

Contents?: true

Size: 408 Bytes

Versions: 1

Compression:

Stored size: 408 Bytes

Contents

require "color/css"

module Smurfville
  module StyleguideHelper

    # returns well readable, high-contrast foreground color ("black" or "white") based on passed background_color
    def foreground_color(background_color)
      if color = Smurfville::ColorVariableParser.parse_color(background_color)
        color.brightness > 0.5 ? "black" : "white"
      else
        "black"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
smurfville-0.0.6 app/helpers/smurfville/styleguide_helper.rb