Sha256: 98c32dafbb95ede88a073175ab1c1294c7b2732cc1701158587727a4d55c65c4

Contents?: true

Size: 391 Bytes

Versions: 1

Compression:

Stored size: 391 Bytes

Contents

require "color/css"

module Smurf
  module StyleguideHelper

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
smurf-rails-0.0.3 app/helpers/smurf/styleguide_helper.rb