Sha256: fe92e5893bb25dcbfb96c6165c6cfa9715ee9d3379980b6c2c42bc3237d8a93d

Contents?: true

Size: 401 Bytes

Versions: 2

Compression:

Stored size: 401 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)
        return "black"  if color.brightness > 0.5
      end
      return "white"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
smurfville-0.0.5 app/helpers/smurfville/styleguide_helper.rb
smurfville-0.0.4 app/helpers/smurfville/styleguide_helper.rb