Sha256: 5b3482dbdddad0f500f1dc70e457d60a2cdde76107bbb7063718aa9b56310fa2
Contents?: true
Size: 617 Bytes
Versions: 2
Compression:
Stored size: 617 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 = (Color::RGB.from_html(background_color) rescue false) || color = Color::CSS[background_color] color.brightness > 0.5 ? "black" : "white" else "black" end end def typography_class(typography) typography.gsub("%f-", "") end def typography_humanized(typography) typography.gsub("%f-", "").gsub("-", " ") end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
smurfville-0.1.1 | app/helpers/smurfville/styleguide_helper.rb |
smurfville-0.1.0 | app/helpers/smurfville/styleguide_helper.rb |