Sha256: 301cb74686a26f745dfde0ca604078d12fa73113ae3780ac0adccb55ea929d1f

Contents?: true

Size: 412 Bytes

Versions: 42

Compression:

Stored size: 412 Bytes

Contents

class NSColor

  def to_s
    return super unless self.respond_to?(:alpha)

    alpha_s = ((alpha || 1) < 1 ? "(#{alpha})" : '')
    if system_name
      return "NSColor.#{system_name}#{alpha_s.length > 0 ? '.colorWithAlphaComponent' + alpha_s : ''}"
    elsif css_name
      return ":#{css_name}.nscolor#{alpha_s}"
    elsif hex
      return "'#{hex}'.nscolor#{alpha_s}"
    else
      super
    end
  end

end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
sugarcube-4.0.0 lib/osx/sugarcube-to_s/nscolor.rb
sugarcube-3.5.0 lib/osx/sugarcube-to_s/nscolor.rb
sugarcube-3.4.2 lib/osx/sugarcube-to_s/nscolor.rb
sugarcube-3.4.1 lib/osx/sugarcube-to_s/nscolor.rb
sugarcube-3.4.0 lib/osx/sugarcube-to_s/nscolor.rb
sugarcube-3.3.7 lib/osx/sugarcube-to_s/nscolor.rb
sugarcube-3.3.6 lib/osx/sugarcube-to_s/nscolor.rb
sugarcube-3.3.5 lib/osx/sugarcube-to_s/nscolor.rb
sugarcube-3.3.4 lib/osx/sugarcube-to_s/nscolor.rb
sugarcube-3.3.3 lib/osx/sugarcube-to_s/nscolor.rb
sugarcube-3.3.2 lib/osx/sugarcube-to_s/nscolor.rb
sugarcube-3.3.1 lib/osx/sugarcube-to_s/nscolor.rb
sugarcube-3.3.0 lib/osx/sugarcube-to_s/nscolor.rb
sugarcube-3.2.0 lib/osx/sugarcube-to_s/nscolor.rb
sugarcube-3.1.1 lib/osx/sugarcube-to_s/nscolor.rb
sugarcube-3.1.0 lib/osx/sugarcube-to_s/nscolor.rb
sugarcube-3.0.8 lib/osx/sugarcube-to_s/nscolor.rb
sugarcube-3.0.7 lib/osx/sugarcube-to_s/nscolor.rb
sugarcube-3.0.6 lib/osx/sugarcube-to_s/nscolor.rb
sugarcube-3.0.5 lib/osx/sugarcube-to_s/nscolor.rb